[PLUG] Fwd: Weird system time issue

Christopher E. Brown cbrown at woods.net
Tue Jul 16 22:49:12 UTC 2002


On Tue, 16 Jul 2002, Rich Shepard wrote:

> On Tue, 16 Jul 2002, Ken Nowack wrote:
>
> > > I can reset the system time, but give it about an hour and it resets
> > > itself for no apparent reason, about 12 hours off. I've tried using
> > > rdate -s every 15 minutes, doesn't help. I've tried setting up ntpd and
> > > using it, but once the system time gets too far off, ntpd dies with no
> > > explanation.
>
> Ken,
>
>   Linux has two clocks. 'rdate' sets the system clock and it's valid only as
> long as you're logged in. 'hwclock' sets the hardware clock, and this is the
> one you want to set correctly. Once you do, you can tell the sysclock to
> sync against the hardware clock. I don't recall off-hand just where it goes,
> but it's one of the startup scripts.


No, Linux has one clock, the system clock.  In normal cases the
platform has a hardware clock (PCs, most workstations), though odd
systems and some embeded hardware lack an RTC.


date rdate, ntpdate, whatever all access/set the system clock.
hwclock (for most platforms) sets system time from hardware or sets
hardware time from system time.  The older 'clock' app did this as
well, but has been retired. (hwclock uses a new and safer access
method than clock for get/set from hardware RTC)


System time is is set from the RTC using hwclock in one of the init
scripts for most systems.  It has nothing to do with any login
session.  It persists until reboot.


Given time, the system time will drift vs RTC time, and both will
drift from real time.  This is why running an ntp client is a good
thing, it keeps the system clock synced.  During system shutdown (for
most distros) system time is written back to the RTC within the init
scripts.  This ensures that as of next boot the RTC is "close enough"
to real time that the initial system clock is near enough to synced
(within 70 seconds for many ntp systems) that the ntp client can drift
the system clock into sync, rather than jumping it. (jumping the clock
must be done manually from the command line and with the client daemon
shutdown)

-- 
I route, therefore you are.





More information about the PLUG mailing list