180°

Programmer reveals cause of Zune blunder

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:



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.
Alternative Sources:
Lord Anubis - contributor
Published: 312 days 10 hours ago | News | Mobile | Tech
 
 
 
10°

Industry News
Intel to pay AMD $1.25 billion as companies end...
Industry News | News
Have Intel got off lightly over their anti-trust case with its rival? Is this the beginning of something special for the future of CPU's? Who know...

Tech
Gadget Singularity: Let's Ditch Our Buttons and...
Tech | Article
The past decade's march towards better gadgets shows a trend line pointing towards ultra powerful gadgets with UIs so seamless, they make Macs look...

Tech
Disney Offering Trade In Program Soon
Tech | News
Jorge from www.blueraycenter.com writes: Did you happen to picking the new Disney-Pixar animated film UP? You did? Then you might have noticed one ...
About N4G
N4G is a social game news site that covers the game industry 24 hours a day, 7 days a week.
More Info... | Submit News