Re: Why touch the CMOS clock?

Ulrich Windl (Ulrich.Windl@rz.uni-regensburg.de)
Wed, 8 May 1996 09:36:04 +0200


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

>=20
> I noticed the 1.3.98 patch contains the following warning:
>=20
> +Also, if the kernel time is synchronized with an external source, th=
e
> +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. If yo=
u
> +don't synchronize the kernel time with an external source (via ntp o=
r
> +whatever) then the kernel will keep its hands off the RTC, allowing =
you
> +exclusive access to the device for your applications.
>=20
> 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=
can't
> the RTC be left running on its own and the RTC time be used only as a=
n
> 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=
of
> 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.

>=20
> Johan Myreen
> jem@iki.fi
Ulrich