Expand description
How far another node’s clock is from this one’s, and how fast the gap grows.
serve_clock answers on CLOCK_PROTOCOL with the node’s clock. measure sends a few requests, and from each reply
takes the offset as the remote reading minus the midpoint of the local send and receive times; the sample with the shortest
round trip wins, since its midpoint error is bounded by half that round trip. DriftFit fits offsets taken over time to a
line, which gives the offset at any moment and the drift between the two clocks in parts per million.
Clocks are functions returning nanoseconds of a monotonic clock (ClockFn), so a node can use the clock its audio runs on.
Structs§
- Clock
Sample - One measurement of another clock against this one.
- Clock
Server - Answering clock requests. Dropping it stops.
- Drift
Fit - Clock samples over time fitted to a line: the offset at any moment, and the drift.
Constants§
- CLOCK_
PROTOCOL - The clock protocol id.
Functions§
- measure
- Measure the clock of
peer(reached throughaddrsif not connected) withprobesexchanges and keep the one with the shortest round trip. - monotonic
- A clock counting from when it was made, on the process’s monotonic clock.
- serve_
clock - Answer clock requests on
nodewithclock. Needs a tokio runtime context.
Type Aliases§
- ClockFn
- A monotonic clock in nanoseconds.