[ltp] getting correct time on a laptop (IBM ThinkPad T23)
Martin Steigerwald
linux-thinkpad@linux-thinkpad.org
Wed, 21 Jun 2006 08:34:54 +0200
Hello,
I have an IBM ThinkPad T23 with highly inaccurate clock. It misses
accurate time by several minutes a day.
Long time I used chrony. It worked most of the time, but not always.
Right now the problems I have with chrony - see below - increased and none
of the other approaches worked like I want.
I want the following:
1) When the laptop has internet access it should synchronise with NTP
time
2) Otherwise a program should correct the clock by its average inaccuracy
(like chrony is supposed to do). That is be important cause sometimes the
laptop is without internet access for several days.
3) Suspend to disk should be handled nicely.
4) Ideally on resume and boot the time is corrected due to NTP time or the
inaccuracy factor via one big step.
Right now I am fighting with chrony and different other approaches and
none of them worked like I want it to.
My problems with chrony:
1) I had chrony claiming that system time had 0 seconds difference to NTP
time while there was a difference of 10 or more minutes. This is with a
standard chrony installation (after aptitude purge chrony).
2) Chrony apparantly cannot set the hardware clock. I get a input/output
error on modprobe rtc, and it seems that the module genrtc doesn't do the
trick. I reverted on not letting chrony do that but the usually debian
hwclock scripts which seems to work.
3) Sometimes net access is not detected properly. I have
copied /etc/ppp/ip-up.d/chrony and /etc/ppp/ip-down.d/chrony
to /etc/network/if-up.d and /etc/network/if-down.d respectively in order
to have chrony switched online and offline accordingly. I am using
ifplugd and guessnet for automatic network configuration on demand which
is worked quite well.
4) After suspend to disk chrony does not seem to have any NTP sources at
all... I tried different approaches, right now I am using:
#!/bin/sh
/etc/init.d/ifplugd stop
ifdown eth0
/etc/init.d/chrony stop
# Noch nicht gespeicherte Daten sichern
sync
# Einschlafen
hibernate
/etc/init.d/chrony start
/etc/init.d/ifplugd start
Rationale for this: chrony and network are stopped before suspend since
they do not work anyway while the notebook is powered off. After resume
chrony is started and should be offline. Then ifplugd is started. Now
whenever a network link is availble network is configured and chrony
should be switched to online mode due to /etc/network/if-up.d/chrony that
I copied there.
But apparently that doesn't work.
I also tried openntpd, which didn't even start on my system as well as the
full blown ntp server which sort of worked, but then it does not
provide . Once I even was desperate enough to just start ntpdate every
hour with a cron job.
On other approach would be to fix the hardware clock such that it would be
that much too slow. Maybe replacing the battery could help? Any other
ideas?
Right now its extremely frustrating cause none of the approaches work to
properly and its that I didnt try hard to make it work.
Ideally I would have something like chrony but with the enhancement that
it would simply work even for suspend and that it just finds out itself
whether internet access is there or not. Switching it to online and
offline mode via scripts is just extremely error prone IMHO.
Any tricks I can play with the chrony configuration to make it work?
chrony seems to be quite old, is upstream still alive? Any sensible
replacement available?
Any ideas? I greatly appreciate it when I could be able to fix up this
time stuff without investing another dozen of hours.
If I cannot fix chrony easily I probably revert to ntp-simple for now and
accept wrong time when the laptop is not with internet access.
Regards,
--
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7