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: 354 days 18 hours ago | News | Mobile | Tech
 
 
 

Tech
Create your own game console skin design with G...
Tech | Article
There are many choices when it comes to skinning your gaming system out there, but GelaSkins offers a unique and very easy to use system to design ...

Tech
The Legit Reviews Best of 2009 Hardware Awards
Tech | Article
Legit Reviews writes: "It is hard to believe that another year flew by so quickly, but it has! That means Legit Reviews has turned seven years...

Industry News
Sony Gets Serious About 3D TV
Industry News | News
PS3Informer writes: "Sony is making some serious moves to get 3D gaming onto your home consoles. Are you ready for it?"

Tech
Iphone Gloves Need Instruction Manuel, but They...
Tech | News
The gloves do work and I enjoy the knitted homegrown feel, but I would like to see a little more surface area to utilize in upcoming models.
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