Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Dec 2014 08:29:05 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 195703] New: Incorrect pre-y2k time retrieval from RTC
Message-ID:  <bug-195703-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195703

            Bug ID: 195703
           Summary: Incorrect pre-y2k time retrieval from RTC
           Product: Base System
           Version: 10.1-STABLE
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: cs@soi.spb.ru

When booting on old hardware with CMOS clock set before year 2000, initial
system time appears to be in the end of twenty first century. On 32-bit systems
it falls beyond 2038 with interesting consequences.

This regression was introduced in 2006 by r162963 (then it was
sys/i386/isa/clock.c).

Here is the patch to correct this problem on modern systems:

--- /usr/src/sys/x86/isa/atrtc.c        2014-08-14 06:33:26.168778002 +0000
+++ atrtc.c     2014-12-04 10:50:10.597250292 +0000
@@ -354,7 +354,7 @@
 #ifdef USE_RTC_CENTURY
        ct.year += readrtc(RTC_CENTURY) * 100;
 #else
-       ct.year += 2000;
+       ct.year += ( ct.year < 70 ? 2000 : 1900 );
 #endif
        critical_exit();
        /* Set dow = -1 because some clocks don't set it correctly. */

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-195703-8>