summaryrefslogtreecommitdiff
path: root/src/common/compat_time.h
AgeCommit message (Collapse)Author
2018-06-28Extract time functionality into lib/wallclock and lib/timeNick Mathewson
2018-06-22Extract our code for answering "what time is it right now".Nick Mathewson
The other time stuff is higher-level
2018-06-20Update copyrights to 2018.Nick Mathewson
2018-04-26Add a function to compute millisecond time difference quickly.Nick Mathewson
Our main function, though accurate on all platforms, can be very slow on 32-bit hosts. This one is faster on all 32-bit hosts, and accurate everywhere except apple, where it will typically be off by 1%. But since 32-bit apple is a relic anyway, I think we should be fine.
2018-04-16Make tor_gettimeofday() mockableNeel Chauhan
2018-04-13Expose a function that computes stamp units from msec.Nick Mathewson
(It turns out we can't just expose STAMP_TICKS_PER_SECOND, since Apple doesn't have that.)
2017-12-13Add a function to add msec to a monotime.Nick Mathewson
We'll use this for the channel padding logic.
2017-12-13Add monotime functions for clearing monotonic timesNick Mathewson
We need this to replace some of our "msec" users with monotime users.
2017-12-08Use mach_approximate_time() for coarse time where available.Nick Mathewson
This lets us have a coarse-time implementation with reasonable performance characteristics on OSX and iOS. Implements 24427.
2017-11-27Add a new notion of "stamps" to be a fast 32-bit monotonic timestampNick Mathewson
The goal here is to replace our use of msec-based timestamps with something less precise, but easier to calculate. We're doing this because calculating lots of msec-based timestamps requires lots of 64/32 division operations, which can be inefficient on 32-bit platforms. We make sure that these stamps can be calculated using only the coarse monotonic timer and 32-bit bitwise operations.
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-09-15Split some long #if lines to make the #endif annotator happyNick Mathewson
2017-03-15Run the copyright update script.Nick Mathewson
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.