Closed jtilahun closed 10 months ago
Is there particular reason to use monotonic
instead of perf_counter
?
Also, would you rather use monotonic_ns
(or perf_counter_ns
) to avoid floating point errors?
Is there particular reason to use
monotonic
instead ofperf_counter
?
Per PEP 418, monotonic
is suitable for implementing a timeout in a program. perf_counter
does exist as well, but perf_counter
is intended for use in performance and benchmarking contexts.
Also, would you rather use
monotonic_ns
(orperf_counter_ns
) to avoid floating point errors?
Are floating point errors a real concern here? If floating point errors are a true concern here, then it's possible to use the corresponding *_ns
function to mitigate that concern.
Per PEP 418 ...
Ah, thanks I didn't know that!
Are floating point errors a real concern here?
Unlikely. I just tend to use *_ns
by default these days.
I'm not officially associated with pyvisa
so feel free to ignore me 😁. For what it's worth (which is basically nil), this LGTM.
I was mostly worried about availability but this function is older than I though so no issue.
For measuring elapsed time, one should use a monotonic clock instead of the system clock because the system clock can go backwards in time, whereas a monotonic clock is guaranteed to be non-decreasing.