diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-04-23 13:33:25 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-04-26 15:44:37 -0400 |
commit | 2c470452fb51453dd7bab8c0d3778bfdfe4bb8e6 (patch) | |
tree | af808f4bae94c06f9c78b100a6f236f81e3e1e92 /time-internal.h | |
parent | a2598ec6bdc2cc8b5eed1f0a9b9ca9539d4667c1 (diff) | |
download | libevent-2c470452fb51453dd7bab8c0d3778bfdfe4bb8e6.tar.gz |
Implement fast/precise monotonic clocks on Windows
This uses code from libutp, which was released under the MIT
license; see evutil_time.c and LICENSE changes.
Diffstat (limited to 'time-internal.h')
-rw-r--r-- | time-internal.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/time-internal.h b/time-internal.h index 823e8af7..a889925c 100644 --- a/time-internal.h +++ b/time-internal.h @@ -56,6 +56,10 @@ extern "C" { long evutil_tv_to_msec_(const struct timeval *tv); void evutil_usleep_(const struct timeval *tv); +#ifdef _WIN32 +typedef ULONGLONG (WINAPI *ev_GetTickCount_func)(void); +#endif + struct evutil_monotonic_timer { #ifdef HAVE_MACH_MONOTONIC @@ -67,8 +71,15 @@ struct evutil_monotonic_timer { #endif #ifdef HAVE_WIN32_MONOTONIC - DWORD last_tick_count; - struct timeval adjust_tick_count; + ev_GetTickCount_func GetTickCount64_fn; + ev_GetTickCount_func GetTickCount_fn; + ev_uint64_t last_tick_count; + ev_uint64_t adjust_tick_count; + + ev_uint64_t first_tick; + ev_uint64_t first_counter; + double usec_per_count; + int use_performance_counter; #endif struct timeval adjust_monotonic_clock; |