1. Home
  2. Computing & Technology
  3. C / C++ / C#
photo of David Bolton
David's C / C++ / C# Blog

By David Bolton, About.com Guide to C / C++ / C#

Many Zune Owners Lost their Music Player on Dec 31

Saturday January 3, 2009
Yes the code from the Zune had a slight date flaw in it and on day 366 of a year (ie every leap year) it hangs in an infinite loop, as many Zune owners found out on the last day of 2008. You can see the full code that this came from.

Leap years are notorious for introducing bugs. Many people think that its just a simple divide by 4, so 2008, 2004, 2000 etc but there's a slight complexity to account for the fact that leap years aren't exactly 366 days long. Every century (1800, 1900) etc is not a leap year unless it's dividable by 400. So 1900 wasn't a leap year but 2000 was.

In fact the whole date/time area can be a minefield as anyone who has used php with MySQL will testify. My advice- find a useful library and stick with it. When it comes to dealing with dates, differences between them adding dates it's fairly ok but add in time zones and then the effects of summer time and it's not as simple!

Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.