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

Alexandre Julliard julliard at winehq.org
Mon Jan 28 13:43:20 CST 2013


Module: wine
Branch: master
Commit: 04e14c7b46df95bf2a80ad04d497d3d927649afd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=04e14c7b46df95bf2a80ad04d497d3d927649afd

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan 28 17:11:25 2013 +0100

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

---

 dlls/ntdll/time.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c
index b9d3f03..d3f4dab 100644
--- a/dlls/ntdll/time.c
+++ b/dlls/ntdll/time.c
@@ -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 );




More information about the wine-cvs mailing list