ntdll: Add support for the monotonic time counter on Mac OS X.

oldstable
Alexandre Julliard 2013-01-28 17:11:25 +01:00
parent 25598513dc
commit 04e14c7b46
1 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,9 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef __APPLE__
# include <mach/mach_time.h>
#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 );