summaryrefslogtreecommitdiffstats
path: root/sys/dev/dec/mcclock.c
diff options
context:
space:
mode:
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