summaryrefslogtreecommitdiffstats
path: root/sys/dev/dec/mcclock.c
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2000-01-04 03:22:04 +0000
committermjacob <mjacob@FreeBSD.org>2000-01-04 03:22:04 +0000
commit8aa7fd43d21fb804431830945d20b9ccab78170f (patch)
tree23bc648f0e4e229e3e01bdb30c693472a704ef60 /sys/dev/dec/mcclock.c
parent24d00c85e402d3980b152dd5f762e5e2f8e7b26a (diff)
downloadFreeBSD-src-8aa7fd43d21fb804431830945d20b9ccab78170f.zip
FreeBSD-src-8aa7fd43d21fb804431830945d20b9ccab78170f.tar.gz
Ho, ho, ho... this clock chip is not y2k compliant. Motorola
has it blacklisted. Silly us for not planning ahead. Tsk. Anyway- a 10 year window patch is probably sufficient to still detect nonsense in the clock but allow us to roll past the year 2000.
Diffstat (limited to 'sys/dev/dec/mcclock.c')
-rw-r--r--sys/dev/dec/mcclock.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/dec/mcclock.c b/sys/dev/dec/mcclock.c
index a8a94be..4efc484 100644
--- a/sys/dev/dec/mcclock.c
+++ b/sys/dev/dec/mcclock.c
@@ -84,6 +84,12 @@ mcclock_get(device_t dev, time_t base, struct clocktime *ct)
ct->day = regs[MC_DOM];
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.
+ */
+ if (ct->year >= 0 && ct->year < 10) {
+ ct->year += 100;
+ }
}
/*
@@ -106,7 +112,14 @@ mcclock_set(device_t dev, struct clocktime *ct)
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.
+ */
+ if (ct->year >= 100) {
+ ct->year -= 100;
+ }
s = splclock();
MC146818_PUTTOD(dev, &regs);
splx(s);
OpenPOWER on IntegriCloud