[ltp] getting correct time on a laptop (IBM ThinkPad T23)

Martin Steigerwald linux-thinkpad@linux-thinkpad.org
Sun, 25 Jun 2006 13:21:15 +0200


Am Samstag 24 Juni 2006 17:22 schrieb Henrique de Moraes Holschuh:
> On Sat, 24 Jun 2006, Martin Steigerwald wrote:
> > slowly to correct for the nightly time differences...) or even more
> > radical a cron job with ntpdate in combination with adjtimex...
>
> That's exactly what chrony is supposed to be.  If it doesn't handle
> things as well as crontab'd ntpdate + adjtimex, it is time to file a
> bug on chrony.

Hello Henrique,

yes, I know. That adjtimex stuff worked, but was lacking in NTP time 
correction when network is available. And a cron job with ntpdate is 
suboptimal as well.

I will try to figure out what goes wrong with chrony and file bug reports 
if I find anything. 

I think it has to do with the complexity of the setup as well that it 
sometimes doesn't work:

1) the laptop is suspended usually... I do not yet know what to do with 
chrony when it suspends. The last thing I tried was stopping chrony 
before suspend and before network is brought down (/etc/init.d/ifplug.d 
stop - maybe suspend could work as well + ifdown eth0) and starting it 
again after resume and network is up... (/etc/init.d/ifplugd 
start ; /etc/init.d/chrony start)... I guess that last order was wrong... 
cause when I place copy offline and online chrony scripts 
in /etc/network/if-up.d and /etc/network/if-down.d I have to start chrony 
before the network is brought up (when there is a link), so that there is 
actually a chrony that can be notified.

Actually after longer power down (either shutdown or suspend to disk) I 
would like chrony to act like ntpdate on booting or resuming the 
machine... thus I would need to adapt a script 
like /etc/ppp/ip-up.d/chrony to issue a "makestep" command...

2) the laptop does not have network connection all the time... I thought 
I'd handle this by copying /etc/ppp/ip-up.d/chrony and ip-down.d chrony 
to /etc/network/if-up.d and if-down.d. I would prefer when chrony would 
just detect itself whether it can contact NTP servers periodically - as 
there might be situations, where scripting it to switch to online and 
offline mode might not work... it shouldn't be that difficult on my 
laptop, cause network is brought down when its not available 
automatically... also it can happen that internet connectivity fails and 
the DNS server does not respond, whatever and chrony should handle such 
situations gracefully as well.

3) handling of the hardware clock... I am not sure which approach is 
best... on Debian it is handled by hwclock usually... I can add 
hwclock -systohc on suspend and hwclock --hctosys on resume or I can put 
an "exit 0" before hwclock scripts and let chrony do all of this...

Any thoughts?

I think I will try to fix chrony now first and file approbiate bug 
reports... maybe I can help writing a document on how to setup chrony for 
laptop use.

Regards,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7