Click to Skip Ad
Closing in...

Programmer reveals cause of Zune blunder

Ok, someone please tell Nelson Muntz he’s on in five… Now that Z2K has come and gone, we have to sit back and wonder how something so widespread could have such a simple fix – wait till it dies, then turn it back on. For real? The good thing, we suppose, was that if there were people who couldn’t manage their way to Google to search for an answer, their Zunes would eventually just start working again. The bad thing of course, was that the cause of the problem was probably something bush league. Indeed – here is the explanation from itsnotabigtruck of Zune Boards:

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.

Here it comes… Haaa haaa! The affected source code causing this bug can also be found in a few other portables such as Toshiba’s S series. If you happen to be one of the few people out there with one of those puppies and you haven’t resolved the issue by now, the fix is the same so don’t fret. We have to imagine Microsoft will have a fix in place before 2012, the next leap year, but this was a massive bungle that Redmond certainly can’t wait to be forgotten. Sure most people will forget, but we wonder if a bad enough taste was left in the mouths of Zune owners to make them think about jumping ship. Some will, no doubt, but we don’t imagine any hardcore anti-iPod people will have their allegiance swayed.


Zach Epstein

Zach Epstein has been the Executive Editor at BGR for more than 10 years. He manages BGR’s editorial team and ensures that best practices are adhered to. He also oversees the Ecommerce team and directs the daily flow of all content.

Zach first joined BGR in 2007 as a Staff Writer covering business, technology, and entertainment. His work has been quoted by countless top news organizations, and he was recently named one of the world's top 10 “power mobile influencers” by Forbes. Prior to BGR, Zach worked as an executive in marketing and business development with two private telcos.