From 04e14c7b46df95bf2a80ad04d497d3d927649afd Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 28 Jan 2013 17:11:25 +0100 Subject: [PATCH] ntdll: Add support for the monotonic time counter on Mac OS X. --- dlls/ntdll/time.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c index b9d3f03c72b..d3f4dabf5fd 100644 --- a/dlls/ntdll/time.c +++ b/dlls/ntdll/time.c @@ -38,6 +38,9 @@ #ifdef HAVE_UNISTD_H # include #endif +#ifdef __APPLE__ +# include +#endif #define NONAMELESSUNION #define NONAMELESSSTRUCT @@ -111,6 +114,11 @@ static ULONGLONG monotonic_counter(void) #endif if (!clock_gettime( CLOCK_MONOTONIC, &ts )) return ts.tv_sec * (ULONGLONG)TICKSPERSEC + ts.tv_nsec / 100; +#elif defined(__APPLE__) + static mach_timebase_info_data_t timebase; + + if (!timebase.denom) mach_timebase_info( &timebase ); + return mach_absolute_time() * timebase.numer / timebase.denom / 100; #endif gettimeofday( &now, 0 );