How to Write a Reference Clock Driver 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 are operative as with ordinary NTP peers. In this way, defective clocks can be detected and removed from the peer population. As no packets are exchanged with a reference clock, however, we replace the transmit, receive and packet procedures with separate code to simulate them. 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. In addition, there may be a driver-specific unit structure used for local control of the device. 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. The ppsclock module is an interface for the PPS signal provided by some radios.