From 8aa7fd43d21fb804431830945d20b9ccab78170f Mon Sep 17 00:00:00 2001 From: mjacob Date: Tue, 4 Jan 2000 03:22:04 +0000 Subject: 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. --- sys/dev/dec/mcclock.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sys/dev/dec/mcclock.c') 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, ®s); splx(s); -- cgit v1.1