How to Write a Reference Clock Driver How to Write a Reference Clock Driver from Pogo , Walt Kelly You need a little magic. Description Reference clock support maintains the fiction that the clock is actually an ordinary peer in the NTP tradition, but operating at a synthetic stratum of zero. The entire suite of algorithms used to filter the received data, select the best clocks or peers and combine them to produce a local clock correction operate just like ordinary NTP peers. In this way, defective clocks can be detected and removed from the peer population. Radio and modem reference clocks by convention have addresses in the form 127.127.
Most clocks require a serial port or special bus peripheral.
A set of utility routines is included to open serial devices, process sample data, edit input lines to extract embedded timestamps and to perform various debugging functions. Additional information includes the receive timestamp, exception report, statistics tallies, etc. The support routines are passed a pointer to the peer structure, which is used for all peer-specific processing and contains a pointer to the refclockproc structure, which in turn contains a pointer to the unit structure, if used. In most cases the drivers do not need to be aware of them, since they are detected at autoconfigure time and loaded automatically when the device is opened. The ppsclock module is an interface for the PPS signal provided by some radios.