Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2015 17:02:10 +0000 (UTC)
From:      Christian Brueffer <brueffer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284931 - head/sys/x86/isa
Message-ID:  <201506291702.t5TH2AUh042604@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Mon Jun 29 17:02:09 2015
New Revision: 284931
URL: https://svnweb.freebsd.org/changeset/base/284931

Log:
  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

Modified:
  head/sys/x86/isa/atrtc.c

Modified: head/sys/x86/isa/atrtc.c
==============================================================================
--- head/sys/x86/isa/atrtc.c	Mon Jun 29 15:38:34 2015	(r284930)
+++ head/sys/x86/isa/atrtc.c	Mon Jun 29 17:02:09 2015	(r284931)
@@ -354,7 +354,7 @@ atrtc_gettime(device_t dev, struct times
 #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. */



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