If you’re using either of these functions to measure latency, you’re doing it wrong. You most likely want to be using time.monotonic() or time.perf_counter(), since neither will be affected by NTP updates.
I’m measuring latency compared to other servers not under my control. More specifically, the time it takes me to receive a message with server-timestamped X, compared to the current time when I receive it. Using non-absolute counters like those you mention makes it impossible to compare timestamps.
In cases where you are comparing local times, I fully agree with you!
If you’re using either of these functions to measure latency, you’re doing it wrong. You most likely want to be using
time.monotonic()
ortime.perf_counter()
, since neither will be affected by NTP updates.I’m measuring latency compared to other servers not under my control. More specifically, the time it takes me to receive a message with server-timestamped X, compared to the current time when I receive it. Using non-absolute counters like those you mention makes it impossible to compare timestamps.
In cases where you are comparing local times, I fully agree with you!
Wouldn’t it be better to use the epoch instead, and even better comparing epochs is computationally the easiest thing in the world.