Shadow Conception
Golden Member
If you haven't heard, all Zune 30s were affected by a freeze today. Now apparently, the problem's been isolated.
The code's as follows (better-syntaxed representation is in the link):
So, the main loop only executes if days are greater than 365. Well, in a typical non-leap year, there are only 365 days, which means that this loop only executes when it's a leap year (366 days). Is this correct?
Additionally, the first if statement only executes if days are greater than 366. In what scenario would days ever be greater than 366? We don't have double leap years, do we? Does this mean that if statement never executes as well?
I'm really confused, maybe I'm just getting it all wrong. Can someone explain this to me?
The code's as follows (better-syntaxed representation is in the link):
year = ORIGINYEAR; /* = 1980 */
while (days > 365) {
if (IsLeapYear(year))
{
if (days > 366)
{
days -= 366;
year += 1;
}
}
else
{
days -= 365;
year += 1;
}
}
So, the main loop only executes if days are greater than 365. Well, in a typical non-leap year, there are only 365 days, which means that this loop only executes when it's a leap year (366 days). Is this correct?
Additionally, the first if statement only executes if days are greater than 366. In what scenario would days ever be greater than 366? We don't have double leap years, do we? Does this mean that if statement never executes as well?
I'm really confused, maybe I'm just getting it all wrong. Can someone explain this to me?