### Reference Clock Drivers

Master Time Facility at the UDel Internet Research Laboratory:

Support for most of the commonly available radio and modem reference clocks is included in the default configuration of the NTP daemon for Unix `ntpd`. Individual clocks can be activated by configuration file commands, specifically the `server` and `fudge` commands described in the `ntpd` program manual page. The following discussion presents Information on how to select and configure the device drivers in a running Unix system.

Many radio reference clocks can be set to display local time as adjusted for timezone and daylight saving mode. For use with NTP the clock must be set for Coordinated Universal Time (UTC) only. Ordinarily, these adjustments are performed by the kernel, so the fact that the clock runs on UTC will be transparent to the user.

Radio and modem clocks by convention have addresses in the form 127.127.t.u, where t is the clock type and u is a unit number in the range 0-3 used to distinguish multiple instances of clocks of the same type. Most of these clocks require support in the form of a serial port or special bus peripheral, but some can work directly from the audio codec found in some workstations. The particular device is normally specified by adding a soft link `/dev/deviceu` to the particular hardware device involved, where `u` correspond to the unit number above.

Most clock drivers communicate with the reference clock using a serial port, usually at 9600 bps. There are several application program interfaces (API) used in the various Unix and NT systems, most of which can be detected at configuration time. Thus, it is important that the NTP daemon and utilities be compiled on the target system or clone. In some cases special features are available, such as timestamping in the kernel or pulse-per-second (PPS) interface. In most cases these features can be detected at configuration time as well; however, the kernel may have to be recompiled in order for them to work.

The audio drivers are a special case. These include support for the NIST time/frequency stations WWV and WWVH, the Canadian time/frequency station CHU and generic IRIG signals. Currently, support for the Solaris and SunOS audio API is included in the distribution. It is left to the volunteer corps to extend this support to other systems. Further information on hookup, debugging and monitoring is given in the Audio Drivers page.

The local clock driver is also a special case. A server configured with this driver can operate as a primary server to synchronize other clients when no other external synchronization sources are available. If the server is connected directly or indirectly to the public Internet, there is some danger that it can adversely affect the operation of unrelated clients. Carefully read the Undisciplined Local Clock page and respect the stratum limit.

The local clock driver also supports an external synchronization source such as a high resolution counter disciplined by a GPS receiver, for example. Further information is on the External Clock Discipline and the Local Clock Driver page.

#### Driver Calibration

Some drivers depending on longwave and shortwave radio services need to know the radio propagation time from the transmitter to the receiver, which can amount to some tens of milliseconds. This must be calculated for each specific receiver location and requires the geographic coordinates of both the transmitter and receiver. The transmitter coordinates for various radio services are given in the Stations, Frequencies and Geographic Coordinates page. Receiver coordinates can be obtained or estimated from various sources. The actual calculations are beyond the scope of this document.

When more than one clock driver is supported, it is often the case that each shows small systematic offset differences relative to the rest. To reduce the effects of jitter when switching from one driver to the another, it is useful to calibrate the drivers to a common ensemble offset. The `enable calibrate` configuration command in the Miscellaneous Options page is useful for this purpose. The calibration function can also be enabled and disabled using the `ntpdc` program utility.

Most clock drivers use the `time1` value specified in the `fudge` configuration command to provide the calibration correction when this cannot be provided by the clock or interface. When the calibration function is enabled, the `time1` value is automatically adjusted to match the offset of the remote server or local clock driver selected for synchronization. Ordinarily, the NTP selection algorithm chooses the best from among all sources, usually the best radio clock determined on the basis of stratum, synchronization distance and jitter. The calibration function adjusts the `time1` values for all clock drivers except this source so that their indicated offsets tend to zero. If the selected source is the kernel PPS discipline, the `fudge time1` values for all clock drivers are adjusted.

The adjustment function is an exponential average designed to improve accuracy, so the function takes some time to converge. The recommended procedure is to enable the function, let it run for an hour or so, then edit the configuration file using the `time1` values displayed by the `ntpq` utility and `clockvar` command. Finally, disable the calibration function to avoid possible future disruptions due to misbehaving clocks or drivers.

#### Performance Enhancements

In general, performance can be improved, especially when more than one clock driver is supported, to use the prefer peer function described in the Mitigation Rules and the `prefer` Keyword page. The prefer peer is ordinarily designated the remote peer or local clock driver which provides the best quality time. All other things equal, only the prefer peer source is used to discipline the system clock and jitter-producing "clockhopping" between sources is avoided. This is valuable when more than one clock driver is present and especially valuable when the PPS clock driver (type 22) is used. Support for PPS signals is summarized in the Pulse-per-second (PPS) Signal Interfacing page.

Where the highest performance is required, generally better than one millisecond, additional hardware and/or software functions may be required. Kernel modifications for precision time are described in the A Kernel Model for Precision Timekeeping page. Special line discipline and streams modules for use in capturing precision timestamps are described in the Line Disciplines and Streams Drivers page.

#### Comprehensive List of Clock Drivers

Following is a list showing the type and title of each driver currently implemented. The compile-time identifier for each is shown in parentheses. Click on a selected type for specific description and configuration documentation, including the clock address, reference ID, driver ID, device name and serial line speed, and features (line disciplines, etc.). For those drivers without specific documentation, please contact the author listed in the Copyright Notice page.

Type 1 Undisciplined Local Clock (`LOCAL`)
Type 2 Trak 8820 GPS Receiver (`GPS_TRAK`)
Type 3 PSTI/Traconex 1020 WWV/WWVH Receiver (`WWV_PST`)
Type 4 Spectracom WWVB and GPS Receivers (`WWVB_SPEC`)
Type 5 TrueTime GPS/GOES/OMEGA Receivers (`TRUETIME`)
Type 6 IRIG Audio Decoder (`IRIG_AUDIO`)
Type 7 Radio CHU Audio Demodulator/Decoder (`CHU`)
Type 8 Generic Reference Driver (`PARSE`)
Type 9 Magnavox MX4200 GPS Receiver (`GPS_MX4200`)
Type 10 Austron 2200A/2201A GPS Receivers (`GPS_AS2201`)
Type 11 Arbiter 1088A/B GPS Receiver (`GPS_ARBITER`)
Type 12 KSI/Odetics TPRO/S IRIG Interface (`IRIG_TPRO`)
Type 13 Leitch CSD 5300 Master Clock Controller (`ATOM_LEITCH`)
Type 14 EES M201 MSF Receiver (`MSF_EES`)
Type 15 * TrueTime generic receivers
Type 16 Bancomm GPS/IRIG Receiver (`GPS_BANCOMM`)
Type 17 Datum Precision Time System (`GPS_DATUM`)
Type 18 NIST Modem Time Service (`ACTS_NIST`)
Type 19 Heath WWV/WWVH Receiver (`WWV_HEATH`)
Type 20 Generic NMEA GPS Receiver (`NMEA`)
Type 21 TrueTime GPS-VME Interface (`GPS_VME`)
Type 22 PPS Clock Discipline (`PPS`)
Type 23 PTB Modem Time Service (`ACTS_PTB`)
Type 24 USNO Modem Time Service (`ACTS_USNO`)
Type 25 * TrueTime generic receivers
Type 26 Hewlett Packard 58503A GPS Receiver (`GPS_HP`)
Type 27 Arcron MSF Receiver (`MSF_ARCRON`)
Type 28 Shared Memory Driver (`SHM`)
Type 29 Trimble Navigation Palisade GPS (`GPS_PALISADE`)
Type 30 Motorola UT Oncore GPS (`GPS_ONCORE`)
Type 31 Rockwell Jupiter GPS (`GPS_JUPITER`)
Type 32 Chrono-log K-series WWVB receiver (`CHRONOLOG`)
Type 33 Dumb Clock (`DUMBCLOCK`)
Type 34 Ultralink WWVB Receivers (`ULINK`)
Type 35 Conrad Parallel Port Radio Clock (`PCF`)
Type 36 Radio WWV/H Audio Demodulator/Decoder (`WWV`)
Type 37 Forum Graphic GPS Dating station (`FG`)
Type 38 hopf GPS/DCF77 6021/komp for Serial Line (`HOPF_S`)
Type 39 hopf GPS/DCF77 6039 for PCI-Bus (`HOPF_P`)
Type 40 JJY Receivers (`JJY`)

* All TrueTime receivers are now supported by one driver, type 5. Types 15 and 25 will be retained only for a limited time and may be reassigned in future.

Additional Information

Mitigation Rules and the `prefer` Keyword
Debugging Hints for Reference Clock Drivers
A Kernel Model for Precision Timekeeping
Line Disciplines and Streams Drivers
Reference Clock Audio Drivers
Pulse-per-second (PPS) Signal Interfacing
How To Write a Reference Clock Driver