Microsoft’s (MSFT) 30GB Zune models, which experienced mass failings worldwide on 12/31/08, are finally up and running again.
So what happened? A Y2K-like bug crashed the Zune on the last day of a leap year. Coder “itsnotabigtruck” on zuneboards.com claims to have isolated the problem. And it sounds like a shockingly basic mistake:
After doing some poking around in the source code for the Zune’s clock driver (available free from the Freescale website), I found the root cause of the now-infamous Zune 30 leapyear issue that struck everyone on New Year’s Eve.
The Zune’s real-time clock stores the time in terms of days and seconds since January 1st, 1980. When the Zune’s clock is accessed, the driver turns the number of days into years/months/days and the number of seconds into hours/minutes/seconds. Likewise, when the clock is set, the driver does the opposite.
The Zune frontend first accesses the clock toward the end of the boot sequence. Doing this triggers the code that reads the clock and converts it to a date and time. Below is the part of this code that determines the year component of the date:
year = ORIGINYEAR; /* = 1980 */
while (days > 365)
if (days > 366)
days -= 366;
year += 1;
days -= 365;
year += 1;
Under normal circumstances, this works just fine. The function keeps subtracting either 365 or 366 until it gets down to less than a year’s worth of days, which it then turns into the month and day of month. Thing is, in the case of the last day of a leap year, it keeps going until it hits 366. Thanks to the if (days > 366), it stops subtracting anything if the loop happens to be on a leap year. But 366 is too large to break out of the main loop, meaning that the Zune keeps looping forever and doesn’t do anything else.
If nothing is done, the bug will occur again on Dec 31, 2012. But Microsoft has promised to update the Zune’s firmware and fix the problem. That is, if it is still making Zunes.
Business Insider Emails & Alerts
Site highlights each day to your inbox.