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.
This commit is contained in:
Matt Jacob 2000-01-04 03:22:04 +00:00
parent b5ce857bec
commit e3bfb27984

View File

@ -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);