RFC Errata
RFC 5905, "Network Time Protocol Version 4: Protocol and Algorithms Specification", June 2010
Note: This RFC has been updated by RFC 7822, RFC 8573, RFC 9109, RFC 9748
Source of RFC: ntp (int)
Errata ID: 8214
Status: Reported
Type: Technical
Publication Format(s) : TEXT
Reported By: Manuel Bergler
Date Reported: 2024-12-18
Section A.5.5.7 says:
/* * rstclock() - clock state machine */ void rstclock( int state, /* new state */ double offset, /* new offset */ double t /* new update time */ ) { /* * Enter new state and set state variables. Note, we use the * time of the last clock filter sample, which must be earlier * than the current time. */ c.state = state; c.last = c.offset = offset; s.t = t; }
It should say:
/* * rstclock() - clock state machine */ void rstclock( int state, /* new state */ double t, /* new update time */ double offset /* new offset */ ) { /* * Enter new state and set state variables. Note, we use the * time of the last clock filter sample, which must be earlier * than the current time. */ c.state = state; c.last = c.offset = offset; s.t = t; }
Notes:
These are all the calls of rstclock in the example code:
- rstclock(FSET, 0, 0); inside main(), pg 71
- rstclock(NSET, 0, 0); inside main(), pg 71
- rstclock(FREQ, p->t, 0); inside local_clock(), pg 100
- rstclock(SYNC, p->t, 0); inside local_clock(), pg 100
- rstclock(FREQ, p->t, offset); inside local_clock(), pg 100
- rstclock(SYNC, p->t, offset); inside local_clock(), pg 101
- rstclock(SYNC, p->t, offset); inside local_clock(), pg 102
All calls use the new update time as the second argument and the new offset as the third argument, or set both to zero. But the definition of rstclock expects the new offset as the second argument and the new update time as the third, i.e. the order of the parameters is flipped.