1. Background

Precise timekeeping is critical for many computer applications: make(1) depends fully on timestamps of multi-dependent files to ensure building correctness; cron(8) run scheduled tasks based on the current time; some network protocols and measuring tools, such as UDT[1], thrulay[2] and owamp[3], make action decisions and network statistics according to the timestamp of sent/received packets. Incorrect and/or inprecise time will bring negative effects to these applications, more or less.

Time sources for a desktop computer could be divided into two major categories: external and local. Representative external sources are NTP servers and GPS timing receivers, and are beyond the topic of this article. We are interested in the local time sources. There are three of them:

  1. On-board hardware clock: it is battery backuped to keep time when the computer is off. The hardware clock is usually accurate enough, provided that the battery has not run out. However, reading hardware clock is expensive, hardware-dependent and usually a system privilege operation.
  2. System clock: The operating system (for example Linux) runs its own clock, and from this clock comes the time shown by commands such as date. Update of this roughly at 10ms inteval. The exact rate depends on your particular system and on Linux it is determined by the constant, HZ. However, the gettimeofday() is reporting time at microsecond interval. The way it achieves that is by interpolating TSC register ticks to microsecond level time. The rate is determined at system start up.
  3. TSC clock: All modern CPUs contain a register which is incremented on every clock cycle, which is refered here as TSC register. This clock has very high resolution, but has relatively high frequency wander due to crystal instability, temperature and power fluctuations and explicit power management.

The motivation of TSC-I2 is to provide accurate and precise time, i.e. a clock that minimizes both offset and interpolation error. We assume system clock is synchonized with NTP server, whose accuracy could be guranteed. In that way, we can use system clock as a reliable time reference with relatively low precision, and take advantage of TSC register's high resolution to achieve precision. This assumption of system clock accuracy is very important for the following sections.

[1] http://udt.sourceforge.net/.
[2] http://www.internet2.edu/~shalunov/thrulay/.
[3] http://e2epi.internet2.edu/owamp/.

Back to project homepage .
Last updated on $Date: 2005/08/29 04:28:43 $ by Xun Luo.