500 ms offset in i386 Real Time Clock setting

BJerrick
2001-01-06T19:36:25Z

Neither hwclock nor the /dev/rtc driver takes the following comment from
set_rtc_mmss() in arch/i386/kernel/time.c into account. As a result, using
hwclock --systohc or --adjust always leaves the Hardware Clock 500 ms ahead of
the System Clock:

* In order to set the CMOS clock precisely, set_rtc_mmss has to be
* called 500 ms after the second nowtime has started, because when
* nowtime is written into the registers of the CMOS clock, it will
* jump to the next second precisely 500 ms later. Check the Motorola
* MC146818A or Dallas DS12887 data sheet for details.

(It looks like the only thing that does account for it is the 11-minute
STA_UNSYNC updater in do_timer_interrupt(), in arch/i386/kernel/time.c .)

Shouldn't there be some kernel interface that hides this machine-dependency
from user-level code; i.e., that sets time more precisely?

Bruce Jerrick
Portland, Oregon, USA
email: bjerrick@easystreet.com