Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 1999 09:00:46 +0200 (SAT)
From:      Robert Nordier <rnordier@nordier.com>
To:        jbg@masterplan.org (Jason George)
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: Year 2000 Compliance
Message-ID:  <199901140700.JAA02866@ceia.nordier.com>
In-Reply-To: <199901140547.WAA11845@gongshow.masterplan.org> from Jason George at "Jan 14, 99 05:47:48 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Jason George wrote:

> I decided to try a rollover on the non-compliant Compaq.  I had never 
> done this before, figuring there was no point.  I was quite surprised in 
> my results.  The Compaq, while running 2.2.8+, rolled over correctly!
> 
> y2k# date
> Fri Dec 31 23:53:22 MST 1999
> y2k# date
> Sat Jan  1 00:00:03 MST 2000
> y2k#
> 
> A reboot into the BIOS screen yields a 01/01/00 CMOS date, a reboot 
> under DOS yields a 01/01/80 system date, and a reboot into FreeBSD
> yields 01/01/2000.
> 
> 
> Is this just luck?  Am I playing with fire here?  Have I stumbled onto a 
> new possible source for cheap NATD packet filters for the new millenium? 
>  :-)

It's not luck.  FreeBSD doesn't rely on the BIOS but reads the PC
real-time clock (RTC) directly.  The RTC keeps track on the year
(00-99), though not the century (which is simply stored in CMOS and
not updated by the hardware).  Because the "century" value is
unreliable -- and isn't really needed to answer the question "What's
today's date?" -- it's usually ignored.

See src/sys/i386/isa/clock.c:

    #ifdef USE_RTC_CENTURY
            year = readrtc(RTC_YEAR) + readrtc(RTC_CENTURY) * 100;
    #else
            year = readrtc(RTC_YEAR) + 1900;
            if (year < 1970)
                    year += 100;
    #endif
            if (year < 1970)
                    goto wrong_time;

-- 
Robert Nordier

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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