Re: Why touch the CMOS clock?

=?iso-8859-1?Q?Johan Myr=E9en?= (
Wed, 8 May 1996 15:13:08 +0300 (EET DST)

On Wed, 8 May 1996, Ulrich Windl wrote:

> On 6 May 96 at 14:21, Johan Myr=E9en wrote:
> > My question is: Why does the kernel have to update the RTC? It is m=
> > understanding that the kernel only reads the RTC at boot time and d=
oes its
> > timekeeping using the timer interrupt. (Correct me if I'm wrong.) W=
hy can't
> > the RTC be left running on its own and the RTC time be used only as=
> > approximation of the real time of day when the machine is power-cyc=
led? You
> > can't trust the RTC anyway if the machine is down for a longer peri=
od of
> > time.
> The RTC usually is more precise than the interrupt driven clock.

True. But the CMOS clock isn't used for timekeeping in the kernel. It i=
s only
read at boot time to initialize the system time. The only reason to upd=
the CMOS clock periodically is so it can be used more accurately to
initialize the system time at the next boot. Setting the CMOS clock is =
essential in synchronizing the system time with an external source.

> In Addidion as long as the RTC runs local time, you will have to chan=
> it when entering/leaving DST.

The clock on Unix machines traditionally runs UTC. Setting the RTC to l=
time is just a hack to keep DOS users happy, not a high priority, IMHO.=

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

No it shouldn't, but if it _does_ make the interrupts unreliable, I'd s=
the CMOS clock updating code should be removed.

Johan Myreen