MOBILE USERS: m.isthmus.com
Connect with Isthmus on Twitter · Facebook · Flickr · Newsletters 
Friday, July 11, 2014 |  Madison, WI: 68.0° F  Fair
Collapse Photo Bar

See you Zune

Wiis, PlayStations, iPads, blogging platforms, Facebook and anything else worthy of buzz in the digital world.

See you Zune

Postby christopher_robin » Fri Jan 02, 2009 1:59 pm

You probably heard that many Zunes stopped working yesterday:

http://www.sfgate.com/cgi-bin/article.c ... 1525C0.DTL
Zune users wake up to find their music gone
Thursday, January 1, 2009
Zune users, particularly of the 30-GB version, have been waking up to find their music players are part of an apocalyptic meltdown.
-------------------
Here's the zune code that turns the RTC's days since 1980 into years.

Can you find the problem? No fair Googling!


year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
if (IsLeapYear(year))
{
if (days > 366)
{
days -= 366;
year += 1;
}
}
else
{
days -= 365;
year += 1;
}
}
christopher_robin
Forum God/Goddess
 
Posts: 2888
Joined: Wed Mar 17, 2004 10:46 am

Re: See you Zune

Postby fisticuffs » Fri Jan 02, 2009 2:20 pm

Nope. can't find a problem. Of course I haven't typed anything like that since turbo pascal circa 1995 so... Figures it would be some junior high asinine mistake. Really gonna cost them.
fisticuffs
Forum God/Goddess
 
Posts: 7778
Joined: Sat Jul 24, 2004 2:49 pm
Location: Slightly outside of Madison

Re: See you Zune

Postby TheBookPolice » Fri Jan 02, 2009 2:34 pm

I had to Google it to even know what the hell I was looking at. Now that I know what I'm looking at, and after initially still not getting it, I get it.

But since I Googled it, I won't spoil it.
TheBookPolice
Forum God/Goddess
 
Posts: 8350
Joined: Fri Aug 04, 2006 1:09 pm
Location: The mystical Far East

Re: See you Zune

Postby bluethedog » Fri Jan 02, 2009 2:56 pm

I'm guessing the > 365 is the problem. If = 365 you would get out of the while loop and hence get an answer a year less than what it should be.

Didn't google it though; is that it?
bluethedog
Forum God/Goddess
 
Posts: 1375
Joined: Mon Jul 11, 2005 7:49 am
Location: West side

Re: See you Zune

Postby TAsunder » Fri Jan 02, 2009 3:01 pm

bluethedog wrote:I'm guessing the > 365 is the problem. If = 365 you would get out of the while loop and hence get an answer a year less than what it should be.

Didn't google it though; is that it?


If you indent the code properly it becomes a little more obvious. A leap year has 366 days, not > 366 days. So on leap years if the day remainder is exactly 366 then it will go into an infinite loop because it never reduces the days below 365 to satisfy the exit condition.
TAsunder
Forum God/Goddess
 
Posts: 4781
Joined: Tue Oct 16, 2001 1:21 pm
Location: Near East Side, Madison

Re: See you Zune

Postby TheBookPolice » Fri Jan 02, 2009 3:07 pm

The source I read said that the if (days > 366) line should read if (days >= 366), but that having the LeapYear line makes the corrected line redundant anyway. What actually happens is that the Zune takes the ifLeapYear line, singles out every leap year, and then fucks up because leap years have 366 days, not 367+ days.

Look forward to the same thing at the end of 2012, Zune owners.
TheBookPolice
Forum God/Goddess
 
Posts: 8350
Joined: Fri Aug 04, 2006 1:09 pm
Location: The mystical Far East

Re: See you Zune

Postby Beer Moon » Sun Jan 04, 2009 1:04 pm

Looks like Zune owners may not have been the only ones.
Beer Moon
Forum God/Goddess
 
Posts: 2032
Joined: Mon Jan 17, 2005 7:08 pm


Return to Technology & Video Games

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests

moviesmusiceats
Select a Movie
Select a Theater


FacebookcommentsViewedForum
  ISTHMUS FLICKR

Promotions Contact us Privacy Policy Jobs Newsletters RSS
Collapse Photo Bar