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

Martin Steigerwald linux-thinkpad@linux-thinkpad.org
Sun, 25 Jun 2006 15:05:13 +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,

I think I found a setup that should do. 

1) realtime clock support should be working. at least trimrtc does work. 
rtcfile is enabled in the config file

2) according to chrony faq hwclock should not update the hardwareclock on 
suspend or shutdown cause chrony wouldnt know that and cannot adjust the 
hardware clock accordingly on the next boot or resume... on bootup 
hwclock --hctosys may be used before starting chrony... so I edited 
out /etc/init.d/hwclock.sh stop with a "return 0".

/etc/hibernate/common.conf seems to be configured correctly already:

### clock
SaveClock restore-only

3) I use this hibernate script:

#!/bin/sh

/etc/init.d/ifplugd stop
ifdown eth0
/etc/init.d/chrony stop

sync
hibernate

/etc/init.d/chrony start
/etc/init.d/ifplugd start

This way chrony should notice that the network goes down, before it is 
stopped, and when the network goes up (as soon as a link is detected)  
after it was started... 

Let's see how that goes.

I am not completely sure whether it makes really sense to use 
hwclock --hctosys on boot or resume - since from what I understand chrony 
should be able handle the RTC clock in such cases too. But it probably 
won't harm either.

I found a hint why chrony sometimes shows system clock is 0.0 seconds 
ahead of NTP time even when they differ. It does not seem to have done 
any measurement in that case. When I manually start one via burst, it 
shows the correct inaccuracy.

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