aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat_time.h
AgeCommit message (Collapse)Author
2016-07-21loony mingwcross bug: insist we dont have clock_gettime.Nick Mathewson
2016-07-21Actually make monotonic time functions mockable.Nick Mathewson
This is different from making the functions mockable, since monotime_t is opaque and so providing mocks for the functions is really hard.
2016-07-21Revert "Make the monotonic{_coarse,}_get() functions mockable."Nick Mathewson
This reverts commit 2999f0b33fec8e91ba8e4680d3f9d03b09fe9501.
2016-07-21Make the monotonic{_coarse,}_get() functions mockable.Nick Mathewson
2016-07-19Expose monotonic time ratchet functions for testing.Nick Mathewson
2016-07-19Basic portable monotonic timer implementationNick Mathewson
This code uses QueryPerformanceCounter() [**] on Windows, mach_absolute_time() on OSX, clock_gettime() where available, and gettimeofday() [*] elsewhere. Timer types are stored in an opaque OS-specific format; the only supported operation is to compute the difference between two timers. [*] As you know, gettimeofday() isn't monotonic, so we include a simple ratchet function to ensure that it only moves forward. [**] As you may not know, QueryPerformanceCounter() isn't actually always as monotonic as you might like it to be, so we ratchet that one too. We also include a "coarse monotonic timer" for cases where we don't actually need high-resolution time. This is GetTickCount{,64}() on Windows, clock_gettime(CLOCK_MONOTONIC_COARSE) on Linux, and falls back to regular monotonic time elsewhere.
2016-07-08Move our "what time is it now" compat functions into a new moduleNick Mathewson
I'm not moving our "format and parse the time" functions, since those have been pretty volatile over the last couple of years.