Skip to main content

sample_from_exchange

Function sample_from_exchange 

Source
pub fn sample_from_exchange(
    exchange: Exchange,
    server_utc_us: i64,
    resolution_us: u64,
    max_rtt_us: u64,
) -> Result<UtcSample, TimingError>
Expand description

Build a sample from a timed exchange and the server time it returned.

The server stamps the time near response generation, so the sample sits at the exchange midpoint; the error bar is half the round trip plus the source’s own resolution_us.

§Errors

TimingError::ExchangeReversed when received_us < sent_us; TimingError::RttTooLarge when the round trip exceeds max_rtt_us.