Re: updating the RTC automagically

Guest section DW (dwguest@win.tue.nl)
Mon, 22 Nov 1999 15:11:55 +0100


On Mon, Nov 22, 1999 at 08:18:31AM +0200, Ulrich Windl wrote:

> Wel, well. How do you explain that the system clock is still the same
> after having used "date -s" several times?

Ulrich,
If you have a buggy date(1) program, get a better one or complain
to its maintainer.
If you have a buggy kernel, complain on this list that the kernel
is broken, preferably with details about what goes wrong.
But the present discussion was not about fixing something,
but about adding new functionality, and I and others thought
that that might be a bad idea.

By the way, on many alpha's the settimeofday system call is broken.

> Should each system have a cron job to update the RTC via hwclock
> hourly, or maybe update it during system shutdown?

The scheme where every 11 min RTC is overwritten by system time
has disadvantages if one wants high precision.
One can observe the drift of the RTC with very high precision
by leaving it alone for a long time.

The ideal setup would never write the RTC, but only read it,
and keep notes on the deviation and the drift, so that some
user space program can set system time from RTC plus this
information in case no better outside time source is available.

The scheme where RTC is set every 11 min is much worse -
each time an error of up to 0.5 sec is introduced, and
such schemes make it impossible to get very reliable data
on the drift of the RTC.

Many programs that try to adjust for drift are now confronted
with a sawtooth effect that is much more complicated to handle
than a linear drift. And while the linear drift is to a first
approximation constant, independent of the OS running, this
sawtooth is present only when the machine is up, running Linux,
and with STA_UNSYNC unset.

This 11 min stuff has other evil effects, as documented:
------ Documentation/rtc.txt ------
Also, if the kernel time is synchronized with an external source, the
kernel will write the time back to the CMOS clock every 11 minutes. In
the process of doing this, the kernel briefly turns off RTC periodic
interrupts, so be aware of this if you are doing serious work.
------

So, I would be happy if this 11 min stuff would be entirely removed.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/