> Could someone provide an introduction to how the rates of these reference
> clocks are adjusted? What's going on inside the black box?
> Can the frequency of the crystal (or whatever) oscillators be adjusted by
> applying some bias voltage?
It's all done by software.
Each CPU has a nominal clock frequency and some counter that ticks at that
The kernel timekeeping routine does something like:
newcycles = readMagicRegister()
cycles = newcycles - oldcycles
oldcycles = newsycles
newtime = oldtime + cycles*timePerCycle
oldtime = newtime
The trick is that you need a lot of low bits in timePerCycle. It's not
simple integer arithmetic.
The kernel has a system call that ntpd uses to tweak the value of
timePerCycle. It's the ntpd drift parameter. Normally it's used to correct
for the crystal being slightly off from the nominal value due to
manufacturing tolerances. It also tracks minor changes due to temperature
Fudging it slightly to implement a leap smear fits well within reasonable
numbers as long as the smear is spread over a long enough time slot. 20
hours is long enough. ntpd can't tell the difference between a leap smear
and a temperature shift.
These are my opinions. I hate spam.
LEAPSECS mailing list