diff options
| author | Matt Jacob <mjacob@FreeBSD.org> | 2001-03-09 20:39:02 +0000 |
|---|---|---|
| committer | Matt Jacob <mjacob@FreeBSD.org> | 2001-03-09 20:39:02 +0000 |
| commit | b42cba33a3273a5adc5e3a9831fad3e09f8a98c9 (patch) | |
| tree | e2023bb70946fdbdfb07502e176148eb2c913070 /sys/dev/dec | |
| parent | 26e6a622c0e2bfcb1a69c75fa949d7d52df2e46f (diff) | |
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.
Notes
svn path=/head/; revision=74051
Diffstat (limited to 'sys/dev/dec')
| -rw-r--r-- | sys/dev/dec/mcclock.c | 15 |
1 files 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); |
