[ntp:questions] Re: NTP for dummies

David Woolley david at djwhome.demon.co.uk
Sat Oct 1 22:09:47 UTC 2005


In article <433E8CD6.7000904 at gis.net>, mayer at gis.net (Danny Mayer) wrote:

> ntpd on Windows does set the CMOS clock, at least it's supposed to.

Not in version 4.2.0 and I would consider it a bug for it to set
in a later version as it would be redundant, would risk a conflict [A]
with the kernel code that already does this, and might fail to
implement the policy that only the low order part of the hardware
clock is adjusted, to allow people to dual boot Windows, which
requires the hardware clock to be in wall clock time.

This code in the linux kernel (2.4.26) already ensures that the CMOS clock
tracks a synchronised software clock (arch/i386/kernel/time.c):

        /*
         * If we have an externally synchronized Linux clock, then update
         * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
         * called as close as possible to 500 ms before the new second starts.
         */
        if ((time_status & STA_UNSYNC) == 0 &&
            xtime.tv_sec > last_rtc_update + 660 &&
            xtime.tv_usec >= 500000 - ((unsigned) tick) / 2 &&
            xtime.tv_usec <= 500000 + ((unsigned) tick) / 2) {
                if (set_rtc_mmss(xtime.tv_sec) == 0)
                        last_rtc_update = xtime.tv_sec;
                else
                        last_rtc_update = xtime.tv_sec - 600; /* do it again in
60 s */
        }


[A] not all versions of linux support /dev/rtc, which would be necessary, but
possibly not sufficient, for user space code to update the clock atomically.




More information about the questions mailing list