CZ EN
Clock in PC

Two entirely different clock objects can be discerned in a personal computer:

Physical object (hardware clock)

Virtual object realized in the operating system (OS) which manifests itself externally in terms of a procedure that returns the current time (e.g. gettimeofday() in Unix). It should be pointed out that the performance of the virtual object may show better than that of the hardware object because the OS can make time corrections. On the other hand, calling the procedure of the virtual object causes a delay which introduces uncertainty into the time information provided. Moreover this delay may be fluctuating by one order of magnitude within the same system.

Deviations used in controlling a NTP system are:

System clock

The hardware in today's modern computers based on Intel technology processors implements the system clock the same way as in the historic PC-AT machines. Each personal computer is also equipped with a backup clock which, however, only serves to set the system clock at booting. This applies to all operating systems from MS-DOS to Linux. The circuitry of the system clock is very simple: A quartz oscillator is generating a signal at frequency f0 = 14.318 MHz which is divided in a modulo-12 frequency divider and modulo-R programmable 16-bit divider (Intel 8254) down to fR = f0/12R. The output signal is fed to the IRQ0 input in the interruption controller. By setting the divider coefficient R appropriately the operating system defines the minimum clock period TR = 1/fR (for instance in MS-DOS TR = 1/(18.2 Hz) = 55 ms or in Linux TR = 1/(100 Hz) = 10 ms). The basic limitation is that the clock of any operating system cannot provide better resolution than TP = 12/f0 = 0.838 μs.

Fortunately the Intel processors Pentium and higher are equipped with a TSC register (Time Stamp Counter) capable of counting the periods of processor ~Rs clocking signal which allows to improve the clock resolution. However, the employment of the TSC register and its cooperation with a counter must be ensured through the operating system. For instance Linux possesses a so called nanokernel which can handle the time information at nanosecond level steps while a common kernel works with a step of 1 μs. A user process can obtain the PC system time in nanosecond steps using the ntp_gettime() function.

Synchronization of primary NTP servers

In most cases the computer is synchronized with on-time second pulses (1 PPS, Pulse per Second) that are commonly applied to the DCD pin of the serial port. Here, an interrupt is invoked and the event is assigned a time stamp through an appropriate by an interrupt utility. The complete time information corresponding to the second pulse can be concurrently transmitted through the serial line.

Factors having the main impact on the synchronization uncertainty against UTC:

Accuracy of NTP synchronization

The accuracy achievable with the NTP protocol depends primarily on the network performance.

In practice a synchronization uncertainty of hundreds of microseconds in LAN and around one millisecond in WAN can be expected assuming the same propagation delays in the two-way communication path between the server and the client. Obviously the synchronization accuracy will be negatively affected by any asymmetry in the path.

TimeCZ Server

The TimeCz Server is directly traceable to the UTC(TP) time scale. The system consists of a NTP computer, control computer, synchronizer and GPS receiver.

NTP computer

An ntpd process (version 4.1.71) runs on the NTP computer which allows to synchronize the internal time scale against 1 PPS UTC(TP) and to send the time information through the NTP protocol to clients upon a timing request. The time information is also provided in terms of the by Time and Daytime protocols. The hardware is a common PC (Pentium III 1,2 GHz) equipped with a temperature compensated quartz oscillator and a special PCI card for processing the 1 PPS synchronizing signal. The computer possesses two network adapters (10/100 Mb/s Ethernet), one with a public IP address and the other for the peer-to-peer communication with the Control computer. Communication with the Synchronizer is ensured via a serial port. The so called nanokernel patch is implemented in applied to the Linux kernel (2.4 series) OS kernel which allows to handle the time in nanoseconds steps. Also contained is the support for the processing of 1 PPS signal. In addition, the kernel has been completed by the PCI card controller. Two other processes run on this machine:

pps_gen
intended to generate a physical 1 PPS NTP signal derived from the NTP internal time. This signal is continuously compared in the Synchronizer (equipped with a simple 100-ns time-interval counter) against the synchronizing signal, i.e. against the UTC(TP) second. The measured time difference indicates the timing error of the NTP server.
ntp_deny
is a process that upon the request from the kpctrl process run on the Control computer either enables or denies the output of all types of time information available from the NTP server to the public network (i.e. NTP, Time and Daytime services).

Control computer

The Control computer is an older Pentium 150 MHz PC with the Linux OS. Communication with the environment is ensured through two network adapters (a public IP address plus peer-to-peer connection to the NTP computer) and two serial ports (Synchronizer and GPS receiver).

Processes running on this machine:

kpc2
Basic control multithread process that allows continuously collecting and evaluating all types of the time information and also the status of the NTP server:
  • Timing error of the NTP internal time against UTC(TP) measured in the Synchronizer.
  • Time information provided by all services of the NTP server (NTP, TIME, and DAYTIME protocols).
  • GPS time - Time information from a reliable external primary NTP time server.
  • Time information from the Control computer - The value and availability of the above data are inspected separately.
Through kpc2 the data are evaluated and classified and then provided to other processes every second. It should be pointed out that the GPS time is just used for checking the time labels but not for NTP synchronization.
kpclie
Takes over the data from kpc2 and presents them to user in an easy-to-survey form. Several kpclie processes can run simultaneously and thus the system can be monitored at more sites at the same time.
kpctrl
Based on the data from kpc2, the process implements an algorithm for making a decision about whether to enable or deny the time service. The kpctrl process passes regularly the decision to the ntp_deny process using the User Datagram Protocol.

Synchronizer

The synchronizer ensures the following functions:

The synchronizer is equipped with two serial ports for communication with the NTP and Control computers in the RS-232 format. The synchronizer transmits the time data to the NTP and Control computers and receives the 1 PPS signal from the NTP computer.

Special hardware used in NTP server

Card for processing the synchronizing signal

As mentioned previously the 1 PPS signal is fed to the DCD serial-port input at a RS-232 level. The change in the DCD input invokes an interrupt that is served by the procedure providing the timestamps. The difficulty arises from the fact that the delay in processing the interrupt varies which causes a synchronization error. This error depends on the operating system, processor speed, and instantaneous load. The delay shows typically 10 to 15 μs. The problem is discussed in detail in the report CESNET 18/2001. A special PCI card has been designed for the time server which allows measurements of the 1 PPS arrival with a resolution of 50 ns.

Temperature compensated quartz oscillator

In current PCs all internal frequencies are derived from a single 14.318 MHz quartz oscillator whose large frequency instability has a negative impact on synchronization accuracy. In order to reduce this impact, a temperature compensated oscillator has been used in the server.