Skip to main content

Module clock

Module clock 

Source
Expand description

A network interface’s PTP hardware clock, which gPTP keeps on the network’s time, read from Linux’s /dev/ptpN, and two such clocks compared. Elsewhere opening fails as unsupported.

Structs§

Comparison
Two clocks compared now and then, with the rate between them, so that a time on one is put on the other as the two stood when it was taken, not as at the last comparison: clocks some ppm apart drift hundreds of ns between comparisons. A line fitted through the comparisons kept gives both, so no one comparison’s error carries over whole.
HardwareClock
A PTP hardware clock.
Reading
A hardware clock against another clock, read between two of the other’s readings: how far it was ahead, and how long the reading took from the other’s first to its second. The hardware clock is latched somewhere in that span, so a reading is off by up to half of it; a slow one, held up on the way to the latch or after it, by up to half of what it took beyond the usual. Comparisons that must hold to less than a microsecond can leave such readings out.

Enums§

SystemClock
One of this computer’s clocks, to compare a hardware clock with.

Functions§

monotonic_now
This computer’s monotonic clock: the clock std::time::Instant reads, as a duration from its unspecified start.
precise_sleeps
Has the calling thread’s sleeps end as close to when they were asked for as the system can, for a thread that paces frames: on Linux a timer slack of a nanosecond in place of 50 microseconds. Elsewhere it does nothing.
suspended
How long this computer has been suspended since it started: what the boot clock has counted beyond the monotonic clock. It grows at each resume. Elsewhere than on Linux it stays zero.
system_now
One of this computer’s clocks, as a duration from its epoch. Elsewhere than on Linux the monotonic clock stands in for all three.