[ntp:questions] Reference clock driver for /dev/rtc

David L. Mills mills at udel.edu
Sat Jun 26 16:34:53 UTC 2010


Calling settimeofday() is completely transparent to the kernel and ntpd 
state variables, including the UNSYNC bit; however, the actions in Linux 
might violate this design. Setting the RTC is a byproduct of 
settimeofday(), but in general setting the time to the current time is a 
no-op, at least to within 800 microseconds in a 1986 SPARC IPC running 
SunOS 4, but much less in modern times. See the comments at about line 
228 in ntp_util.c; note the code is enabled by the DOSYNCTODR define.

If there is a more generic way to set the RTC over all or most operating 
systems, it should be reconsidered. The Linux folks are invited to 
contribute #ifdefs as necessary. As it is, the current code goes back to 
SunOS circa 1986.


 Kalle Pokki wrote:

>On Sat, Jun 26, 2010 at 11:48, David Woolley
><david at ex.djwhome.demon.invalid> wrote:
>>I think you missed Dave Mills' point that ntpd does this every 60 minutes,
>>so will also break mechanisms for compensating for RTC drift whilst the
>>processor is powered down.
>I don't understand.
>Settimeofday() isn't about updating the RTC. It updates the system
>clock. Why would ntpd call that regularly and cause unnecessary jumps
>in system time?
>Calling settimeofday() also clears all NTP state variables inside the
>kernel and sets the UNSYNC bit.
>questions mailing list
>questions at lists.ntp.org

More information about the questions mailing list