[CLUE-Tech] clock skew
David Anselmi
anselmi at americanisp.net
Sun Sep 15 19:42:07 MDT 2002
David Willson wrote:
> Man, could this clock skew be any worse? I have two problems:
>
> 1) If I suspend my laptop, it will sometimes set the hardware clock to
> UTC, which throws everything off by six hours. I assume that it is not
> intermittent, but I have not yet discovered the when-it-happens.
I don't know anything about the suspend/resume process, do you? I guess
it isn't done with run levels. There's an apm module that I use to
power off desktop machines from software. It probably has some kind of
config/scripting to do things going into or out of suspend (obviously
the system clock has to be reset since it will be behind by some
amount). So you have to find out how that happens and how to tell it
the hwclock is in local time.
Do you ever adjust the system and hw clocks manually? Seems to me that
the hwclock command remembers whether you were in UTC or local, so if
you use the wrong switch and confuse it that might explain the
intermittent-ness.
Have a look at the docs for apmd and linux/Documentation for the apm module.
> 2) My software clock loses a little over a second every minute. Is
> there any way to tell Linux to just ~use~ and ~trust~ the hardware
> clock? I am lucky enough to have one that works pretty well; it seems a
> shame to waste it.
By software clock, you mean the system time the kernel keeps, right? My
understanding is that the kernel keeps time based on the cpu timing
which should be very stable. Normally this is much more accurate than
the hw clock. If yours isn't, that would be an interesting problem to
solve. Have you looked at any of the laptop sites for a discussion of
this being a problem with your particular model?
In any case, to sync the kernel clock with the hwclock use:
hwclock --hctosys (and the appropriate switch to tell it your hw clock
is in local time)
You could run that from a cron job every 5 min or so. But I would think
there's a better way if we understood what was really going on.
Sorry I can't be more help, I don't have the luxury of doing a lot of
research at the moment.
Dave
More information about the clue-tech
mailing list