Skip to main content

round_trip

Function round_trip 

Source
pub fn round_trip(
    now: u32,
    last_sender_report: u32,
    delay: u32,
) -> Option<Duration>
Expand description

The round-trip time from a report block, per RFC 3550 §6.4.1.

now is the middle 32 bits of our clock when the report arrived, last_sender_report is what the peer echoed of ours, and delay is how long the peer sat on it. Subtracting the peer’s own delay is the whole point: without it, an implementation that reports every five seconds looks five seconds away.

None when there is nothing to compute from — a peer that has had no sender report from us echoes zero — or when the arithmetic comes out negative, which means one of the two clocks moved and the answer would be fiction.