summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authorbrueffer <brueffer@FreeBSD.org>2015-06-29 17:02:09 +0000
committerbrueffer <brueffer@FreeBSD.org>2015-06-29 17:02:09 +0000
commit406a68d5cf19d289af7d5e1f1c79b38dedb21d82 (patch)
tree9e83f0c1eba5b8bf214e250846a013ae8848d304 /sys/x86
parenta2bc12fac69b4ebff6eee954e0b38286901c1b38 (diff)
downloadFreeBSD-src-406a68d5cf19d289af7d5e1f1c79b38dedb21d82.zip
FreeBSD-src-406a68d5cf19d289af7d5e1f1c79b38dedb21d82.tar.gz
Set the initial system time to a sane (as in: not end of 21st century) value when
booting on a PC with CMOS clock set to a year before 2000. This uses 1980 (instead of 1970 as in the initial patch) as pivot year as suggested by imp in the PR followup. PR: 195703 Submitted by: cs@soi.spb.ru Reviewed by: imp MFC after: 1 weeks
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/isa/atrtc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c
index 69c2157..d969594 100644
--- a/sys/x86/isa/atrtc.c
+++ b/sys/x86/isa/atrtc.c
@@ -354,7 +354,7 @@ atrtc_gettime(device_t dev, struct timespec *ts)
#ifdef USE_RTC_CENTURY
ct.year += readrtc(RTC_CENTURY) * 100;
#else
- ct.year += 2000;
+ ct.year += (ct.year < 80 ? 2000 : 1900);
#endif
critical_exit();
/* Set dow = -1 because some clocks don't set it correctly. */
OpenPOWER on IntegriCloud