Skip to content

ntpstats.network

Packet-network timing metrics: delay floor, asymmetry wedge, FPP, clock filter.

NTP (and PTP without on-path support) measures offset through a packet network whose queueing delay is variable and generally asymmetric. For a single exchange the true offset theta satisfies::

|measured_offset - theta| <= (delay - delay_asym_free) / 2

so samples whose round-trip delay is close to the floor (minimum) delay carry the least error. These helpers quantify that; they need a delay column (peerstats, rawstats, chrony measurements, ntpstats monitor CSV or simulated data).

delay_stats(series, cluster=None)

Round-trip delay distribution and the offset/delay relationship.

cluster is the width above the floor delay used for the "floor fraction" (default: 10 % of the median queueing delay, min 50 µs).

wedge(series)

Data for the classic Mills offset-vs-delay "wedge" scatter plot.

Returns (queueing_delay, offset, bound) where bound = queueing/2 is the maximum offset error the extra delay could have introduced.

floor_packet_percentage(series, window=200.0, cluster=0.00015, floor=None)

Floor Packet Percentage in the style of ITU-T G.8260 (Appendix I).

For consecutive windows of window seconds, the percentage of packets whose delay lies within cluster seconds of the floor delay (the minimum over the whole record unless floor is given). Returns (window_start_times, fpp_percent). G.8260 evaluates the two directions separately with one-way delays; NTP logs only give round trip delay, so this is the round-trip analogue.

min_delay_filter(series, window=8)

NTP-style clock filter: from each sliding window of window samples keep the one with the smallest round-trip delay (RFC 5905 section 10 uses an 8-stage shift register). Duplicates are removed.