The code that caused certain Zunes to freeze is here. And the offending logic:
BOOL ConvertDays(UINT32 days, SYSTEMTIME* lpTime)
int dayofweek, month, year;
//Calculate current day of the week
dayofweek = GetDayOfWeek(days);
year = ORIGINYEAR;
while (days > 365)
if (days > 366)
days -= 366;
year += 1;
days -= 365;
year += 1;
So what happened to all of those poor Zunes? The code looks at the number of days that has elapsed since a predefined ORIGINYEAR of January 1, 1980. Then it keeps on subtracting 365 days (or 366, in the case of a leap year) from the total number of days, adding one to the year value, until it can no longer do so. What should result is the correct year.
However, if you push December 31 through on a leap year then there are 366 days. Which is greater than 365 days but not greater than 366 days.
The code goes something like this. Are the number of days greater than 366? Yes. Is it a leap year? Yes. Are the days greater than 366? No. And so nothing happens. The code loops back and continues to repeat FOREVER.
Result? Frozen Zune.
Leave a ReplyWant to join the discussion?
Feel free to contribute!