schweikert / fping

High performance ping tool
https://fping.org
Other
1.03k stars 251 forks source link

Bogus values for -D if SO_TIMESTAMPNS is unavailable #216

Closed sthen closed 3 years ago

sthen commented 3 years ago

If the OS doesn't have SO_TIMESTAMPNS then fping chooses CLOCK_MONOTONIC for its timer if available. This results in bogus values for timestamps with fping -D as it uses an uptime-based clock rather than realtime.

$ fping -D -c1 127.0.0.1 2> /dev/null             
[596040.03537] 127.0.0.1 : [0], 64 bytes, 0.122 ms (0.122 avg, 0% loss)

This was introduced in 754a21e2bdf2 (https://github.com/schweikert/fping/blob/eac20347bac9aa396fa1c2039c57e7603862e6cc/src/fping.c#L127) when SO_TIMESTAMP was replaced with SO_TIMESTAMPNS.

sthen commented 3 years ago

Oh, this is a duplicate of https://github.com/schweikert/fping/issues/203