News for hackers. Stuff that matters.
Re:Source code of the file with the Zune bug (starts on line... by blablebla on Friday January 02, 2009 @10:25AM (#417363)
How about a little more CORRECTer?

#define diy(y) (IsLeapYear(y) ? 366 : 355)

while (days > diy(year)) { days -= diy(year); year += 1; }

Re:Source code of the file with the Zune bug (starts on line... by ars on Friday January 02, 2009 @10:39AM (#417370)
For the confused: the year changes each time, so you need to recheck IsLeapYear each time.

But I wouldn't do it with a define but rather:

while (days > (days_in_year = IsLeapYear(year) ? 366 : 365)) { days -= days_in_year; year += 1; }