The code that allegedly broke the Zune →
https://marco.org/2009/01/01/the-code-that-allegedly-broke-the-zune
Via jstn.
while (days > 365) { if (IsLeapYear(year)) { if (days > 366) { days -= 366; year += 1; } } else { days -= 365; year += 1; } }
Out of curiosity, why was this being rewritten by Freescale or Microsoft at all? This has been a solved problem for a very long time.
(Also, this is very ugly C style in many places. I expected better from Microsoft.)