ZeroTierOne icon indicating copy to clipboard operation
ZeroTierOne copied to clipboard

Use ticks and not wall time to do internal timings when possible

Open adamierymenko opened this issue 8 years ago • 1 comments

On Windows this is easy. On Linux this is CLOCK_MONOTONIC_RAW or CLOCK_MONOTONIC_COARSE. Not sure about others. Wall time can be used if a faster and invariant (on a given boot) timer is not available. Note that a few functions like detecting sleep/wake will still need to use wall time.

adamierymenko avatar Nov 29 '17 22:11 adamierymenko

Looks like CLOCK_MONOTONIC_COARSE is the way to go on Linux and mach_absolute_time() on OSX, at least as far as performance go. Windows has a well known ticks function. Other platforms can use wall time.

adamierymenko avatar Nov 29 '17 22:11 adamierymenko