Staffing Talk » Technology » Can You Spot The Bug?

Can You Spot The Bug?

Written by

January 2, 2009

You probably read about all the Microsoft Zunes that stopped working at midnight on New Year’s eve.  Here is the code that caused them to break.  Can you spot the bug?  $10 Starbucks card to the first correct comment posted.

BOOL ConvertDays(UINT32 days, SYSTEMTIME* lpTime){    int dayofweek, month, year;    UINT8 *month_tab;

    //Calculate current day of the week    dayofweek = GetDayOfWeek(days);

    year = ORIGINYEAR;

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

Leave a Comment

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Previous post:

Next post: