<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Strict//EN">
<html><head><title>
A Kernel Model for Precision Timekeeping
</title></head><body><h3>
A Kernel Model for Precision Timekeeping
</h3><hr>

<p>The technical memorandum: <cite>A Kernel Model for Precision
Timekeeping</cite><a
href="ftp://ftp.udel.edu/pub/people/mills/memos/memo96b.ps">
(PostScript) </a> describes an engineering model which implements a
precision time-of-day function for a generic operating system. The model
is based on the principles of disciplined oscillators using phase-lock
loops (PLL) and frequency-lock loops (FLL) often found in the
engineering literature. The model implements a hybrid PLL/FLL discipline
algorithm implemented in the kernel. The hybrid loop provides automatic
time and frequency steering with update intervals from a few seconds to
several hours.

<p>The hybrid PLL/FLL has been implemented in the Unix kernels for
several workstations, including those made by Sun Microsystems, Digital
and Hewlett Packard. The model changes the way the system clock is
adjusted in time and frequency, as well as provides mechanisms to
discipline its time and frequency to an external precision timing
source, such as a pulse-per-second (PPS) signal. The model incorporates
a generic system-call interface for use with the Network Time Protocol
(NTP) or similar time synchronization protocol. The NTP Version 3 daemon
<code>xntpd</code> operates with this model to provide synchronization
limited in principle only by the accuracy and stability of the external
timing source.

<p>This memorandum does not propose a standard protocol, specification
or algorithm. It is intended to provoke comment, refinement and
implementations for kernels not considered herein. While a working
knowledge of NTP is not required for an understanding of the design
principles or implementation of the model, it may be helpful in
understanding how the model behaves in a fully functional timekeeping
system.

<p>The model has been implemented in the Unix kernels for Sun
Microsystems, Digital and Hewlett Packard workstations. In addition, for
the Digital machines the model provides improved precision to one
microsecond. Since these specific implementations involve modifications
to licensed code, they cannot be provided directly. Inquiries should be
directed to the manufacturer's representatives. However, the engineering
model for these implementations, including a simulator with code
segments almost identical to the implementations, but not involving
licensed code, is available <a href =
"ftp://ftp.udel.edu/pub/ntp/kernel.tar.Z">kernel.tar.Z</a> via anonymous
FTP.

<p>There are two new system calls defined in the model,
<code>ntp_gettime()</code>, which returns a structure including the
current time, estimated error and maximum error, and
<code>ntp_adjtime()</code>, which provides a means to adjust kernel
variables, including the current time and frequency offsets. Further
information on the calling sequences and variable definitions are in the
<code>./include/sys/timex.h</code> file.

<hr><address>David L. Mills (mills@udel.edu)</address></body></html>
