Index: kernel/time.c =================================================================== RCS file: /root/21REP/linux21/kernel/time.c,v retrieving revision 1.1.1.4.2.1 retrieving revision 1.1.1.4.2.2 diff -u -r1.1.1.4.2.1 -r1.1.1.4.2.2 --- kernel/time.c 1999/12/20 20:23:59 1.1.1.4.2.1 +++ kernel/time.c 2000/01/05 20:14:24 1.1.1.4.2.2 @@ -98,8 +98,8 @@ * ``ktime_to_rtc'' and ``rtc_to_ktime'' to convert between kernel time * and RTC time, depending on the timezone of the RTC (local or UTC). * The new functions obsolete ``warp_clock()''. - * 1999-09-17 Andrea Arcangeli - * Fixed adjtimex/settimeofday/stime SMP races. + * 2000-01-05 Ulrich Windl, Harald Koenig + * Fixed Y2K bug in ``ktime_to_rtc()''. */ #include #define NTP_NANO /* we want to see nanoseconds in */ @@ -389,10 +389,10 @@ day = t / 86400; /* days since epoch (1970) */ year = day / 365; /* non-leap years since epoch */ /* correct for leap years in epoch: 1972 (2) was the first */ - if ((year + 2) / 4 + 365 * year > day) + if ((year + 1) / 4 + 365 * year > day) year--; /* reduce to day in current year */ - day -= (year + 2) / 4 + 365 * year; + day -= (year + 1) / 4 + 365 * year; /* map March, 1st to Feburary, 29nd for leap years */ if (day == 59 && ((year + 2) & 3) == 0) { nl_day = day;