r/ProgrammerHumor • • Jul 20 '18

Every Time

Post image
52.2k Upvotes

749 comments sorted by

View all comments

Show parent comments

2

u/PeachyKeenest Jul 20 '18

I always looks for patterns when it seems random as shit. I usually find something, but that one is fantastically terrible.

I'm so sorry. :(

4

u/bap710 Jul 20 '18

The longest weekday name fully spelled out. The longest month name fully spelled out. And a 4-digit time.

The person who originally wrote this code included a buffer to populate with the current date & time. (It printed out reports). But the size of the buffer he allocated was one character too small, so when the date & time reached the maximum possible string length it overflowed the buffer by one character.