Re: Why touch the CMOS clock?

=?iso-8859-1?Q?Johan Myr=E9en?= (jem@vistacom.fi)
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:
>=20
> > My question is: Why does the kernel have to update the RTC? It is m=
y
> > 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=
an
> > 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.
>=20
> 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=
ate
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 =
not
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=
ge
> it when entering/leaving DST.

The clock on Unix machines traditionally runs UTC. Setting the RTC to l=
ocal
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=
ay=20
the CMOS clock updating code should be removed.

--
Johan Myreen
jem@iki.fi