Saturday, April 08, 2000

Time



B wrote:
> G wrote:
> >Heh.  Mine's been contemplating time.  It took me forever to figure out
> >to set the timezone via:
> >ln -sf /usr/share/zoneinfo/US/Hawaii /etc/localtime
> 
>         (Not going to take effect until you reboot?  Your mail appears
> to be in the same timezone as before.)

Aaaaaargh!!!  hhh hhh hhh hhh.  Grrggglllsplltchtct.

So... I adjusted the time zone as per above, then set the system clock with 'netdate,' (a cute
program I stumbled on earlier in this saga) and then reset the hardware clock to universal
time
via
/sbin/hwclock --systohc --utc

Everything hunky dory.  Until I rebooted, which seemed a good idea after setting the hwclock.
The hwclock was changed by 4 hours or so after the reboot.  ?!?  So I rebooted and sheepishly
played with the windows95 time tool, thinking that maybe it had a strangle hold on the BIOS,
but no... a reboot into linux once again changed the clock by 4 hours.  So I tried setting it
again, rebooted, and it changed it again, this time by 3 hours or so.  Hrrmphlgrglspt.
Fiddled with hwclock some more, waded through man pages, thought I had it all figured out,
with UTC conversion and all, but the next reboot changed it by 2.5 hours.  Hmmm, the
convergent series was noted, but an asymptotic approach to the correct time via progressive
rebooting did not seem very satisfying...

so I dove into /etc/rc.d/rc.sysinit, found the clock setting part of the script, and chased
shell variables around until I saw that it was calling "hwclock --adjust" at boot time.  My
first impulse was to just delete the damn script segment, but this was tempered by a curiosity
to resolve the production of that particular temporal-geometric series.  It turns out that
each time the hwclock is reset, the time difference (assumed to be a minor correction), as
well as the date of reset, is written into /etc/adjtime.  At each boot, "hwclock --adjust"
uses this information to extrapolate to what it thinks is a more accurate time, and resets the
hwclock accordingly.  Thus the series brought about by, in this case, the "minor correction"
being several hours in the course of a day or so.

Problem solved by "rm /etc/adjtime" and another clock setting.

It's kind of nifty that Linux provides such accurate time via this system, but at this point I
think my personal clock has lost several more hours that will never be recovered...


[Prev | Index | Next]


gar@lisi.com