Pure Danger Tech


navigation
home

Zune death

02 Jan 2009

Not sure how many people have seen this story but the Microsoft Zune had a widespread problem where it died if powered up on Dec. 31st and refused to start. Apparently it was a leap year problem in calculating the length of the leap year. Even better, here’s the code in question (starting line 259): [source:cplusplus]

while (days > 365)

{

if (IsLeapYear(year))

{

if (days > 366)

{

days -= 366;

year += 1;

}

}

else

{

days -= 365;

year += 1;

}

}

[/source]

Looks like that days > 366 should be days = 366. Hmmm…maybe a good candidate for a unit test, you think?