found in some older IBM PS/2 machines.
This code is based upon work by Scott D. Telford, with some minor bits
in arch/i386/mca/mca_machdep.c taken from FreeBSD.
XXX this is still very experimental and development version; use at your
XXX own risk
tick and the hardware mysteriously responds fast enough that the delay ends
up being 1 tick short. An unlikely event, but just in case anything actually
relies on this...
if it contained a "19" before. There are machines (in particular PS/2
descendants) which have a checksum at this place.
Introduce a patchable kernel variable "rtc_update_century" to modify
the behaviour: 1="always update" (for testing and if one wants to set
the clock back) or -1="never touch".
"bcdtobin". The old names were bogus.
2) Make the code grok the NVRAM's century field. This code is, to say
the least, poorly tested. It should make NetBSD play nicer with other
OSes that care about the century field, however.
BCD into the year field of the RTC in years > 1999. It seems to have
worked just fine on my old broken down test machine, but apparently
some others actually get hurt. Suckage. We now make sure that we load
valid BCD.
Other ports should check for variations on this theme.
clock past the End of Time.
If time_t is 32 bits, then the "End of Time" is Jan 18/19 2038
(depending on time zone).
This code copes with RTC's past the end of time if time_t is an int32
or less. It just forces the time back to 2037. This will let users
with screwed up clocks to at least boot and function long enough to
set their clocks to something sane.
This kludge is conditioned on an
if (sizeof(time_t) <= sizeof(int32_t))
which will automatically optimize the code out once we switch time_t
to a 64 bit quantity, which should happen well before 2037.
Patch based on code from Michael C. Richardson, with help from
Allen Briggs who pointed out a fencepost error.
-don't enable interrupts at the end of gettick(), restore the previous
state instead
-start timer/counter 0 from delay() if necessary
-comment out "findcpuspeed()", it would clobber the timer again, and it
is unused anyway
* Add table-driven assembly-coded microtime().
* add boot-time computation of the interpolation table,
allowing the hand-coded microtime() to work with locally-tuned
nonstandard values of HZ or TIMER_FREQ.
* delete old C version of microtime().
Eliminate obsolete global kernel variable "struct timezone tz"
Add RTC_OFFSET option
Add global kernel variable rtc_offset, which is initialized by
RTC_OFFSET at kernel compile time.
on i386, x68k, mac68k, pc532 and arm32, RTC_OFFSET indicates how many
minutes west (east) of GMT the hardware RTC runs. Defaults to 0.
Places where tz variable was used to indicate this in the past have
been replaced with rtc_offset.
Add sysctl interface to rtc_offset.
Kill obsolete DST_* macros in sys/time.h
gettimeofday now always returns zeroed timezone if zone is requested.
settimeofday now ignores and logs attempts to set non-existant kernel
timezone.
warn user and user base time. if base time < 1985, warn the user.
if base time 5 or more years different than clock time, warn user,
and if it's base time that's greater, use it. (The latter case is
handy if one has a machine in which the CMOS battery is dead... I do.)
wrap the various uses of the chip (including the uses of the NVRAM on it)
around the new defintions, structures, and functions specified in the header.