summaryrefslogtreecommitdiffstats
path: root/sys/pc98/cbus
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2007-07-23 09:42:32 +0000
committerdwmalone <dwmalone@FreeBSD.org>2007-07-23 09:42:32 +0000
commite8276674f3dc77e497ee2600cd45f51e731c6dab (patch)
tree9e35e0b6e5b6c0c6047ac01c3aa7bf287ef1c85d /sys/pc98/cbus
parent9f42d6219fe8097ea3b6faf2beb93af539c11208 (diff)
downloadFreeBSD-src-e8276674f3dc77e497ee2600cd45f51e731c6dab.zip
FreeBSD-src-e8276674f3dc77e497ee2600cd45f51e731c6dab.tar.gz
If clock_ct_to_ts fails to convert time time from the real time clock,
print a one line error message. Add some comments on not being able to trust the day of week field (I'll act on these comments in a follow up commit). Approved by: re MFC after: 3 weeks
Diffstat (limited to 'sys/pc98/cbus')
-rw-r--r--sys/pc98/cbus/clock.c6
-rw-r--r--sys/pc98/cbus/pcrtc.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c
index 874109a..7b993dc 100644
--- a/sys/pc98/cbus/clock.c
+++ b/sys/pc98/cbus/clock.c
@@ -638,7 +638,11 @@ inittodr(time_t base)
ct.year = bcd2bin(rtc_inb() & 0xff) + 1900; /* year */
if (ct.year < 1995)
ct.year += 100;
- clock_ct_to_ts(&ct, &ts);
+ /* Should we set dow = -1 because some clocks don't set it correctly? */
+ if (clock_ct_to_ts(&ct, &ts)) {
+ printf("Invalid time in clock: check and reset the date!\n");
+ return;
+ }
ts.tv_sec += utc_offset();
tc_setclock(&ts);
}
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 874109a..7b993dc 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -638,7 +638,11 @@ inittodr(time_t base)
ct.year = bcd2bin(rtc_inb() & 0xff) + 1900; /* year */
if (ct.year < 1995)
ct.year += 100;
- clock_ct_to_ts(&ct, &ts);
+ /* Should we set dow = -1 because some clocks don't set it correctly? */
+ if (clock_ct_to_ts(&ct, &ts)) {
+ printf("Invalid time in clock: check and reset the date!\n");
+ return;
+ }
ts.tv_sec += utc_offset();
tc_setclock(&ts);
}
OpenPOWER on IntegriCloud