From a6a451d74aaac31c4ebac57432c18061b5d1befd Mon Sep 17 00:00:00 2001 From: mjacob Date: Fri, 9 Mar 2001 20:39:02 +0000 Subject: [PATCH] Fix a botch where we wrote the year register with > 2 digits (and then knocked the extra digits off). Blegh. Update the comment and adjustment method reading the chip clock year register to note that anything less than 70 means we're past the year 2000. --- sys/dev/dec/mcclock.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/dev/dec/mcclock.c b/sys/dev/dec/mcclock.c index 4efc484e7bcf..9cb3af200ce1 100644 --- a/sys/dev/dec/mcclock.c +++ b/sys/dev/dec/mcclock.c @@ -85,9 +85,10 @@ mcclock_get(device_t dev, time_t base, struct clocktime *ct) ct->mon = regs[MC_MONTH]; ct->year = regs[MC_YEAR]; /* - * This chip is not y2k compliant, so we'll do a 10 year window fix. + * This chip is not y2k compliant- If it's less than + * 70, we're clearly past the year 2000. */ - if (ct->year >= 0 && ct->year < 10) { + if (ct->year < 70) { ct->year += 100; } } @@ -111,15 +112,11 @@ mcclock_set(device_t dev, struct clocktime *ct) regs[MC_DOW] = ct->dow; regs[MC_DOM] = ct->day; regs[MC_MONTH] = ct->mon; - regs[MC_YEAR] = ct->year; /* - * This chip is not y2k compliant, so we'll do a 10 year window fix. - * It's probably okay to write more than 100, but let's not and - * and say we didn't. + * This chip is not y2k compliant- write it with + * no more than two digits. */ - if (ct->year >= 100) { - ct->year -= 100; - } + regs[MC_YEAR] = ct->year % 100; s = splclock(); MC146818_PUTTOD(dev, ®s); splx(s);