You are invited to Log in or Register a free Frihost Account!

Adventures in Computer Clock Adjustment

Adventures in Computer Clock Adjustment

I am running Linux and Openntp to keep my time syncronized. Ideally, I should determine about how fast or slow my computer clock runs, and set the kernel's clock-adjustment parameters to a constant which makes it very close on average.

I discovered that on my machine, every time I reboot the clock frequency jumps by 100 parts per million or more, then remains close to the same as long as it runs. This behavior was so unexpected that I decided to examine it further.

The Linux kernel has two parameters to adjust the clock rate, "tick" and "frequency". Tick is the number of times the clock was originally supposed to cycle before it generated an interrupt and incremented the time by 1/100 of a second; nominally 10000. Frequency is a fine-tuning adjustment, such that adding 65,536 (2^16) to it would slow the clock by one part per million (ppm).

If you study the history of time-keeping in Linux, you will discover that these are left over from historical mechanisms and my explanation is somewhat oversimplified. In today's kernels, increasing tick by one will slow the clock by about 100 ppm and increasing frequency by 6.5 million will have the same effect.

There are at least two clock chips which can be chosen in modern cpu's for timekeeping. I have explored switching the source, and had similar results with either one, though I have forgotten the details.

If anyone else is interested in computer timekeeping and/or use of the ntp protocol, feel free to post to this thread.

1 blog comments below


Sounds like a mission. I tell you what it's probably possible to reset from an analogue source but you'd need some clever code to implement it. There are very powerful shortwave transmitters across the world that act as time servers. I have analogue clocks that set themselves. They have been around for years I totally forgot until the other day when I dug one out.
Josso on Mon May 28, 2012 4:28 pm

© 2005-2011 Frihost, forums powered by phpBB.