···946 year = sd->Year;947 days += year * 365;948 days += (year/4); /* leap year */000000000949 /* adjust for leap year where we are still before leap day */950 days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0);951 sec += 24 * 60 * 60 * days;
···946 year = sd->Year;947 days += year * 365;948 days += (year/4); /* leap year */949+ /* generalized leap year calculation is more complex, ie no leap year950+ for years/100 except for years/400, but since the maximum number for DOS951+ year is 2**7, the last year is 1980+127, which means we need only952+ consider 2 special case years, ie the years 2000 and 2100, and only953+ adjust for the lack of leap year for the year 2100, as 2000 was a 954+ leap year (divisable by 400) */955+ if(year >= 120) /* the year 2100 */956+ days = days - 1; /* do not count leap year for the year 2100 */957+958 /* adjust for leap year where we are still before leap day */959 days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0);960 sec += 24 * 60 * 60 * days;