Quote:
Originally Posted by freshlogic
I think changing line 263 from "if(days > 366)" to "if(days >= 366)" might fix the bug:
|
That would prevent the infinite loop, but would introduce a new bug where it advances the year on the last day of a leap year. It would have thought today was December 31, 2009. That's better than locking up, but it also would mean that all time-limited DRM media would stop working. So, if you have a Zune Pass, none of your songs would play.
What's needed is a break within an else like this (I hope, my C's a little rusty, and was never that good to begin with):
Code:
year = ORIGINYEAR; /* = 1980 */
while (days > 365)
{
if (IsLeapYear(year))
{
if (days > 366)
{
days -= 366;
year += 1;
}
else
{
break;
}
}
else
{
days -= 365;
year += 1;
}
}