9
$\begingroup$

I just came across this note in my office!

Date of writing: Sept. 9th, 2015

In exactly one week from today, and then a week from that date and then another week afterwards, something will happen that causes certain badly designed computer programs to function improperly on those days.

It happens those three days and no other days in the year 2015. In any given year it will happen in exactly three days out of the year.

What might this finicky event be?

$\endgroup$
  • 5
    $\begingroup$ Exactly one week from today is my birthday! Is that just a red herring? $\endgroup$ – Bailey M Sep 9 '15 at 22:30
  • 2
    $\begingroup$ Yeah, that's got nothing to do with it. $\endgroup$ – Joe Z. Sep 9 '15 at 22:53
  • 2
    $\begingroup$ Sorry if you dislike my edit, it was the easiest way I could put in the proper dates with adding meta information $\endgroup$ – warspyking Sep 10 '15 at 1:41
  • 1
    $\begingroup$ Question: is it the same days each year? Or do they differ each year? $\endgroup$ – warspyking Sep 10 '15 at 1:52
  • 1
    $\begingroup$ Questions: Do we need some country-specific knowledge or will it only happen in certain countries? Does the problem occur at a specific time, or all throughout the days? $\endgroup$ – Ken Y-N Sep 10 '15 at 2:29
6
$\begingroup$

The answer is:

Every Wednesday in September with a double digit for the date. Programs writing out the date like "Wednesday September 16th, 2015" will have the longest print on these days because Wednesday and September have the most letters out of the days of the week and months of the year respectively. For the above example format, if the print buffer is a char[30], there will be a buffer overflow for these three days of the year.


Old alternative answer

Potential answer:

if(strcmp(dayoftheweek,"Wednesday")==0 && (day==16||day==23||day==30) && monthoftheyear%2==1)destroyEverything();

Explanation:

This line of code snuck in by a mischievous programmer would make any program fail three days of every year. Every year has two months where the Wednesdays fall on the 16th, 23rd, and the 30th, and they fall on even and odd months. Last year's occurred in July. (Note: leaving out platform-specific access of date information)

$\endgroup$
  • $\begingroup$ That's a bit too roundabout. The error I'm thinking of was an innocent error, not something deliberately contrived like that one. $\endgroup$ – Joe Z. Sep 10 '15 at 3:51
  • $\begingroup$ I'll give you a hint, though: you're on the right track thinking about Wednesdays. $\endgroup$ – Joe Z. Sep 10 '15 at 3:53
  • 1
    $\begingroup$ Your answer is now correct. It's actually based off of this answer to an old, closed StackOverflow question. I posed it as a question to somebody, to guess what sort of bug they might have gotten with the date, and thought, hmm, this might make a good puzzle. $\endgroup$ – Joe Z. Sep 10 '15 at 3:59
  • 2
    $\begingroup$ @CodeNewbie C strings have a null byte to indicate the end of the string. $\endgroup$ – isaacg Sep 10 '15 at 5:18
  • 1
    $\begingroup$ @CodeNewbie TIL what TIL stands for! $\endgroup$ – Quark Sep 12 '15 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.