ntpd and Re: [ltp] getting correct time on a laptop (IBM ThinkPad T23)

Florian Reitmeir linux-thinkpad@linux-thinkpad.org
Mon, 26 Jun 2006 00:13:58 +0200


On Son, 25 Jun 2006, Martin Steigerwald wrote:
> Am Sonntag 25 Juni 2006 20:06 schrieb George Yanos:
> > I've been reading along on this thread and have a question.  What
> > is the reason NOT to use ntpd by itself.  It seems to keep my laptop
> > perfectly in sync with my time server, which keeps itself perfectly
> > in sync with USNO.
> my laptop is without network connections for several days sometimes and 
> the hardware clock is very inaccurate. I did not record it exactly, but 5 
> minutes off in 1-2 days is easily possible.
> 
> Chrony records that inaccuracy even without network access - as good as it 
> can estimate it - and adjusts its the clock accordingly.

i hope it common knowdledge that the linux kernel doesn't use the hardware
clock to measure time.

a normal PC uses many timer devices 
- RTC stores the "bios time", its used after booting to set the time
  http://en.wikipedia.org/wiki/Real-time_clock
- many timers in varios resolutions
  http://en.wikipedia.org/wiki/Clock_rate

normally the RTC is very accurate, and if its not, there is really nothing
which could be done to get things better.

the kernel uses one of the timer to measure time, and time should always go
forward and never jump backward. (ntpdate via cron is a really good way to
crash filesystems/databases ...)

adjtimex/hwclock/ntpd ... they try to adjust the timer which the kernel uses,
to make the clock go slower/faster and then sync.

- ntpd is a finetuning tool, its not designed to make large adjustments
- adjtimex is the tool to get really broken hardware in shape..


so in your case, first.. 
- test the bios time, is it working correct? (read it, turn the laptop off,
	read it again.. )
- if its not the bios time, then correct which hwclock/adjtimex your timer,
	so openntp/ntpd/chrony can work.

-- 
Florian Reitmeir