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?

5 comments:

Anonymous said...

Awwwwesome. I didn't know Microsoft had monkeys that flunked first grade working for them. Guess they get to work that extra day for free?

Unknown said...

I was a Wang Field Engineer back in the day and on 12/31/1980 we got to work to find all the Wang VS (super-mini) systems broken. A leap year bug in the file deletion code prevented temporary files from being deleted at log off, thus preventing another log on.

The problem is that no one tests properly 'around the edges'

Anonymous said...

[url=http://www.hamamatsustation.co.jp/]浜松ステーションホテル[/url]
[url=http://www.hamamatsustation.co.jp/]浜松市 ホテル[/url]
[url=http://www.hamamatsustation.co.jp/]浜松市 ビジネスホテル[/url]

jimmychooshoes said...

Christian Louboutin Double Platform Sandal
Christian Louboutin Double-Platform Sandal
Christian Louboutin DV Diamonds 100 sandals
Christian Louboutin Ernesta patent sandals
Christian Louboutin Etrier 100 sandals
Christian Louboutin Fortuna 120 platform sandals
Christian Louboutin Fox Trot slingbacks
Christian Louboutin Frescobaldi sandals
Christian Louboutin Frouprive 120 sandal
Christian Louboutin Galaxy Pass 100 sandals
CHRISTIAN LOUBOUTIN Gino T-Strap Sandals (Noir, Argent)
Christian Louboutin Glitter Slingback Black Glitter Heels

online generic viagra said...

Amazing work..great code determined here..I must appreciate for this.