Name

clockspeed — speed up or slow down the local clock, continuously

Synopsis

clockspeed

Description

clockspeed resets the local UNIX clock every three seconds according to (1) an internal hardware counter on the central processing unit and (2) occasional real-time measurements from a reliable source.

Caution

On older x86 and amd64 processors, the CPU's internal counter does not run at a constant rate, as its update frequency is determined by CPU frequency, which the operating system can vary dynamically according to system load and system power management policy. The same is true for the virtual count register of arm64 processors. Only use clockspeed on processors that have what the amd64 world calls an "Invariant Time-Stamp Counter", whose update frequency is fixed.

clockspeed reads the real-time measurements from /usr/local/clockspeed/adjust, a FIFO which it creates and reads from. Each real-time measurement must be a single 16-byte packet, expressed as a TAI64NA time adjustment to the local UNIX clock. This is the output of programs such as taiclock(1) and sntpclock(1).

clockspeed does not place any limits on the possible adjustments. It is your responsibility to make sure that the measurements are reliable.

After two real-time measurements, clockspeed can figure out the number of real attoseconds per CPU tick. It saves this number in TAI64NA format in /usr/local/clockspeed/etc/atto, overwriting /usr/local/clockspeed/etc/atto.tmp for reliability. It reads /usr/local/clockspeed/etc/atto when it starts up again.

clockspeed must be run by root.

History

clockspeed was originally part of Daniel J. Bernstein's clockspeed toolset in 1998.

Author

Original code and documentation by Daniel J. Bernstein. Documentation modernizations by Jonathan de Boyne Pollard.