Seting the hardware clock

David Kelly dkelly at
Mon Jul 14 17:24:18 PDT 2003

On Monday 14 July 2003 06:16 pm, stan wrote:
> ;m struggling with getting the hardware clock (BIOS clock) equal to
> the kernels time.
> On my Linux boxes a utility called hwclock is run on the way down to
> synchronize the 2.
> The problem I'm running into is that if the time on the system gets
> to far out of date for ntpd to bring it into synch, then I can update
> the kernels clock with ntpdate. But when I reboot the old incorrect
> time comes back.
> I ran into this during some software testing, that required setting
> the clock pretty far off of real time, and it was a PIA to get the
> machine back to the correct time.
> How _should_ this be handled?

adjkerntz(8) holds the key to synchronizing kernel and BIOS/CMOS clock 

As for your kernel clock not holding good time, there are ways to 
correct that too. Ntpd can not keep the popular Soekris boards (based 
on AMD Elan SC520) in sync without tuning the time standard used in the 
kernel. Forgot if it gains or loses 4 to 5 minutes per day without mod.

Because you are having problems keeping time, and other problems writing 
time, there may be something odd about your motherboard. Maybe there is 
something to protect the CMOS clock from being written to? Some sort of 
BIOS virus protection?

Another thing we saw with Soekris and FreeBSD 4.x was that FreeBSD wrote 
Sunday as 0 but would accept 0 or 7 on read, Soekris clock hardware was 
happy with 0, but BIOS demanded 7 else it assumed the clock was corrupt 
and reset its time to Jan 1, 1980. This only mattered if you rebooted 
on Sunday. Its a 2 byte patch to FreeBSD 4.x, already included in 5.x.

David Kelly N4HHE, dkelly at
The human mind ordinarily operates at only ten percent of its
capacity -- the rest is overhead for the operating system.

More information about the freebsd-questions mailing list