summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2001-03-09 20:39:02 +0000
committermjacob <mjacob@FreeBSD.org>2001-03-09 20:39:02 +0000
commita6a451d74aaac31c4ebac57432c18061b5d1befd (patch)
tree9cda9484f49a512e938a3b4b1b75967efc278858
parentc46089815b36c89c975b82747cb02876915674ee (diff)
downloadFreeBSD-src-a6a451d74aaac31c4ebac57432c18061b5d1befd.zip
FreeBSD-src-a6a451d74aaac31c4ebac57432c18061b5d1befd.tar.gz
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.
-rw-r--r--sys/dev/dec/mcclock.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/dev/dec/mcclock.c b/sys/dev/dec/mcclock.c
index 4efc484..9cb3af2 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, &regs);
splx(s);
OpenPOWER on IntegriCloud