Showing posts with label date bug. Show all posts
Showing posts with label date bug. Show all posts

Wednesday, December 31, 2008

Happy New Year! And welcome back, Zune-sters!

Amazingly, someone has already determined the flaw causing all those Zunes to lock up today.

When I checked this MAKE magazine article describing the bug (part of the free runtime library provided by Freescale), all the code was rendered as left-aligned text in my browser.

year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
if (IsLeapYear(year))
{
if (days > 366)
{
days -= 366;
year += 1;
}
}
else
{
days -= 365;
year += 1;
}
}


I couldn't see the flaw. Can you?

I reformatted the code in TextMate, and the problem became apparent.

year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
  if (IsLeapYear(year))
  {
    if (days > 366)
    {
      days -= 366;
    year += 1;
    }
  }
  else
  {
    days -= 365;
    year += 1;
  }
}


Can you see it now? Thought so. I wonder how many people will complain about their Zombie-Zunes on Dec 31, 2012?