PDA

View Full Version : system clock runs fast



UselessPython
11-15-2003, 05:11 PM
The clock on my laptop runs a bit fast (no matter what OS I'm running on it, but it's been straight debian-style knoppix for a while now). Can someone point out a simple enough way to correct the time from a remote time server or similar?

isparry
11-15-2003, 06:47 PM
Disclaimer, this is generic advice, not tested on Knoppix as I am currently downloading it.

As a first step you should look at the manual page for hwclock. It has facilities to account for clock drift, and is probably already installed.

I like Dan Bernsteins 'clockspeed' package. Essentially have to download the source and compile it. You then give it an accurate time using NTP, wait a while, give it a second accurate time using NTP. It then uses this to work out how much it has to adjust your clock by, and then sits in the background doing so.

Available from http://cr.yp.to

Warnings. Dan's stuff is not "Open Source". You get the source code from him, and can do anything you like with it except redistribute it. I have no problem with this, but some people do.

It uses the high resolution clock cycle counter on your machine, so if your machine changes its clock rate, then 'clockspeed' will not work for you.

You can write a tiny shell script which calls adjtimex in an infinite loop, or failing that you can always write a small C (or whatever) program, which calls 'adjtime', then sleeps in an infinite loop.

Stephen
11-15-2003, 08:56 PM
The clock on my laptop runs a bit fast (no matter what OS I'm running on it, but it's been straight debian-style knoppix for a while now). Can someone point out a simple enough way to correct the time from a remote time server or similar?

Installing ntp and ntp-simple should do what you want you will have to set a time server in a config file and that should be it.


The config file would be /etc/ntp.conf put the servers at the bottom.

stukennedyuk
11-16-2003, 08:13 PM
I found this on Google:-

rdate -s ntp2b.mcc.ac.uk

- run it from the command line or from a script that runs at boot. Actually I think is was Stephen (from the last post) - didn't you suggest adding these sorts of things to the bootmisc.sh script? - It works great if you do add it there.

The network time server in the command above is (obviously) UK based, you need to find one nearby, another job for Google?

many thanks, Stu.....