Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jan 1999 09:25:27 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        jbg@masterplan.org, rnordier@nordier.com
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: Year 2000 Compliance
Message-ID:  <199901142225.JAA11144@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> 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.

Isn't Y2K "compliant" RTC hardware supposed to update the century
register?  In any case, FreeBSD doesn't trust the hardware, the BIOS
or itself to update the century register.  It converts years 70-99 to
1970-1999 and years 00-69 to 2000-2069.  This is good enough until
2070.

>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;
>

The undocumented option USE_RTC_CENTURY exposes the full hardware/BIOS
Y2K breakage (if any) although it may give Y2.070K "compliance".  Don't
use until people start worrying about Y2.070K.

Bruce

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?199901142225.JAA11144>