Microsoft Zune fail because of this For loop

Wonder why Microsoft Zune fail on New Year leap year? It’s because of a Freescale date routine!

[code lang=”c”]year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
if (IsLeapYear(year))
{
if (days > 366)
{
days -= 366;
year += 1;
}
}
else
{
days -= 365;
year += 1;
}
}[/code]

Under normal circumstances, this works just fine. The function keeps subtracting either 365 or 366 until it gets down to less than a year’s worth of days, which it then turns into the month and day of month. Thing is, in the case of the last day of a leap year, it keeps going until it hits 366. Thanks to the if (days > 366), it stops subtracting anything if the loop happens to be on a leap year. But 366 is too large to break out of the main loop, meaning that the Zune keeps looping forever and doesn’t do anything else. (Source: ZuneBoard)

User “itsnotabigtruck” of ZuneBoard forum made that interesting find.

Oh, so this is Coke Zero

I was talking to a random person at Plaza Singapura. I don’t remember her name already maybe sherlynn or something. She was telling that it’s leap year that day. I heard ‘libya‘.

Leap Year VS Libya

She: Hey you know today is leap year.
Me: Libya?
She: Yeah, leap year.
Me: Is that what you call it – libya?
She: Ya, every four years is a leap year. You never heard of ‘leap year’?
Me: Erm… Isn’t Libya a…
She: Leap year is any year you can divide by four. It’s a special occasion for girls, if a girl proposes on leap year, the guy has to accept.
Me: Oh… Happy Libya to you then.
She: Happy Leap Year!

[ad#simple]

Libya is the country with a green flag, totally green!. Designers went lazy. Well, at least the kids had an easier time. I always can’t drag the Singapore flag nicely ’cause all the stars have to be position this and that way. And we have like five stars on our flag and I sucked in drawing stars. I drew circles instead and got scolded. Luckily I wasn’t born in U.S.A., I’ll have to draw 50 of them.

Okay, I drifted off totally. Anyway, that girl was asking me if I would be attending Coke Zero launch tomorrow, you know the day after Libya. And she had to explain to me what Coke Zero is. Finally I get to taste it:

Oh, so this is Coke Zero.