The NTP filtering and selection algorithms act upon a set of
variables for clock offset theta ,THETA, roundtrip delay delta ,DELTA and dispersion epsilon , EPSILON. When necessary to distinguish
between them, lowercase Greek letters are used for variables relative to a peer, while uppercase Greek letters are used for
variables relative to the primary reference source(s), i.e., via the peer to the root of the synchronization subnet. Subscripts will
be used to identify the particular peer when this is not clear from context. The algorithms are based on a quantity called the
synchronization distance lambda ,LAMBDA, which is computed from the roundtrip delay and dispersion as described below.
As described in Appendix H, the peer dispersion epsilon includes contributions due to measurement error
p=1<< sys.precision, skewerror accumulation phi tau, where phi = NTP.MAXSKEW over NTP.MAXAGE is the maximum skew rate and tau =
sys.clock  peer.update is the interval since the last update, and filter (sample) dispersion epsilon sub sigma computed by the
clockfilter algorithm. The root dispersion EPSILON includes contributions due to the selected peer dispersion epsilon and skewerror
accumulation phi tau, together with the root dispersion for the peer itself. The system dispersion includes the select (sample)
dispersion epsilon sub xi computed by the clockselect algorithm and the absolute initial clock offset  THETA  provided to the
localclock algorithm. Both epsilon and EPSILON are dynamic quantities, since they depend on the elapsed time tau since the last
update, as well as the sample dispersions calculated by the algorithms.
Each time the relevant peer variables are updated, all dispersions associated with that peer are updated to reflect the skewerror
accumulation. The computations can be summarized as follows:
theta == peer.offset,
delta == peer.delay,
epsilon == peer.dispersion = rho + phi tau + epsilon sub sigma,
lambda == epsilon +  delta  over 2,
where tau is the interval since the original timestamp (from which theta and delta were determined) was transmitted to the present
time and epsilon sub sigma is the filter dispersion (see clockfilter procedure below). The variables relative to the root of the
synchronization subnet via peer i are determined as follows:
THETA sub i == theta sub i ,
DELTA sub i == peer.rootdelay + delta sub i,
EPSILON sub i == peer.rootdispersion + epsilon sub i + phi tau sub i ,
LAMBDA sub i == EPSILON sub i +  DELTA sub i  over 2 ,
where all variables are understood to pertain to the ith peer. Finally, assuming the ith peer is selected for synchronization, the
system variables are determined as follows:
THETA = combined final offset ,
DELTA = DELTA sub i,
EPSILON = EPSILON sub i + epsilon sub xi +  THETA  ,
LAMBDA = LAMBDA sub i ,
where epsilon sub xi is the select dispersion (see clockselection procedure below).
Informal pseudocode which accomplishes these computations is presented below. Note that the pseudocode is represented in no
particular language, although it has many similarities to the C language. Specific details on the important algorithms are further
illustrated in the Clanguage routines in Appendix I.

