mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
ddd69d391e
There are a bunch of backends that can give us a reasonably good monotonic timer quickly, or a very precise monotonic timer less quickly. For example, Linux has CLOCK_MONOTONIC_COARSE (1msec precision), which is over twice as fast as CLOCK_MONOTONIC. Since epoll only lets you wait with 1msec precision, CLOCK_MONOTONIC_COARSE is a clear win. On Windows, you've got GetTickCount{,64}() which is fast, and QueryPerformanceCounter, which is precise but slow. Note that even in the cases where the underlying timer claims to have nanosecond resolution, we're still not exposing that via Libevent. Note also that "Precision" isn't the same as "Resolution" or "Accuracy". A timer's precision is the smallest change that the clock will register; a timer's resolution is the fineness of its underlying representation; a timer's accuracy is how much it drifts with respect to "Real Time", whatever that means. (Terms and definitions from PEP 418.)