Documentation
¶
Overview ¶
Package clock measures how far this machine's clock is from UTC.
ETSI EN 319 401 §7.10 asks that the clock be synchronised with UTC and that the synchronisation be recorded. Recording it is the part that concerns this repository: an audit trail whose timestamps nobody ever checked is one whose ordering an auditor has to take on faith, and "recorded" means there is an event saying it was checked and by how much it was out.
What this does not do is set the clock. That belongs to whatever runs the machine, and a component that both sets the time and records the times of things would be marking its own paper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reading ¶
type Reading struct {
// Source is the reference that answered.
Source string
// Offset is the correction this clock needs to match the reference: the
// reference's time minus this clock's. Positive means this clock is behind
// and should move forward. That is the sign RFC 5905 §8 gives it, and the
// sign matters more than most: a recorded offset whose direction a reader
// has to guess says nothing about whether events were stamped early or late.
Offset time.Duration
// Delay is the round trip less the time the server held the request. Of
// several readings the one with the shortest round trip is the most
// trustworthy, because the offset's error is bounded by half the delay.
Delay time.Duration
// Stratum is how far the reference is from a reference clock.
Stratum uint8
}
Reading is one comparison against one reference.
func Best ¶
Best asks every server and returns the reading with the shortest round trip, because the error in an offset is bounded by half the delay that carried it.
A server that does not answer is not a failure: the point of naming several is that one may be unreachable. All of them failing is.