Re: Why touch the CMOS clock?

Ulrich Windl (
Wed, 8 May 1996 09:36:04 +0200

On 6 May 96 at 14:21, Johan Myr=E9en wrote:

> I noticed the 1.3.98 patch contains the following warning:
> +Also, if the kernel time is synchronized with an external source, th=
> +kernel will write the time back to the CMOS clock every 11 minutes. =
> +the process of doing this, the kernel briefly turns off RTC periodic
> +interrupts, so be aware of this if you are doing serious work. If yo=
> +don't synchronize the kernel time with an external source (via ntp o=
> +whatever) then the kernel will keep its hands off the RTC, allowing =
> +exclusive access to the device for your applications.
> My question is: Why does the kernel have to update the RTC? It is my
> understanding that the kernel only reads the RTC at boot time and doe=
s its
> timekeeping using the timer interrupt. (Correct me if I'm wrong.) Why=
> the RTC be left running on its own and the RTC time be used only as a=
> approximation of the real time of day when the machine is power-cycle=
d? You
> can't trust the RTC anyway if the machine is down for a longer period=
> time.

The RTC usually is more precise than the interrupt driven clock. In=20
Addidion as long as the RTC runs local time, you will have to change=20
it when entering/leaving DST. Despite of that I've seen several=20
occasions where the CMOS clock was not being updated even when the=20
kernel clock was synchronized.

I think the RTC should be updated, even when the hardware is somewhat=20
broken: Setting the time shouldn't affect periodic interrupts.

Maybe itimer just should preempt a running task so that you don't=20
have to use /dev/rtc.

> Johan Myreen