pub struct Received {
pub len: usize,
pub peer: SocketAddr,
pub kernel_rx_ns: Option<i64>,
}Expand description
One received datagram: how many bytes, from whom, and — where the kernel provides it — when it actually arrived.
Fields§
§len: usize§peer: SocketAddr§kernel_rx_ns: Option<i64>Kernel receive timestamp in Unix seconds, when SO_TIMESTAMPING is
enabled and the stack supplied one.
This is the timestamp that matters for accuracy: it is taken when the packet reaches the kernel, not when userspace happens to be scheduled to read it. The gap between those two is scheduling latency, and on a busy machine it is the single largest error in an otherwise good exchange. Kernel receive time, in whole NANOSECONDS since the Unix epoch.
Integer, not seconds-as-f64. The kernel hands over an exact timespec;
folding it into an f64 of seconds-since-1970 rounds it to the 238 ns
gap between representable values at today’s epoch, and to 477 ns once
Unix time crosses 2^31 in February 2038. The wire resolution this
timestamp is compared against is 2^-32 s — 0.233 ns — so that
conversion was discarding three orders of magnitude before any
arithmetic happened.