Ken Thomases : server: On macOS, don't use clock_gettime() even if it' s available.

Alexandre Julliard julliard at winehq.org
Fri Jun 2 17:03:27 CDT 2017


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Thu Jun  1 14:48:06 2017 -0500

server: On macOS, don't use clock_gettime() even if it's available.

The problem is building against the 10.12 or later SDK but deploying to 10.11
or earlier.  Support for clock_gettime() is new with 10.12 so configure finds
it and the code uses it, but the symbol is weak linked and resolves to NULL
when running on earlier versions.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/request.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/request.c b/server/request.c
index 781889c..6120bc5 100644
--- a/server/request.c
+++ b/server/request.c
@@ -518,7 +518,12 @@ int send_client_fd( struct process *process, int fd, obj_handle_t handle )
 /* get current tick count to return to client */
 unsigned int get_tick_count(void)
 {
-#ifdef HAVE_CLOCK_GETTIME
+#ifdef __APPLE__
+    static mach_timebase_info_data_t timebase;
+
+    if (!timebase.denom) mach_timebase_info( &timebase );
+    return mach_absolute_time() * timebase.numer / timebase.denom / 1000000;
+#elif defined(HAVE_CLOCK_GETTIME)
     struct timespec ts;
 #ifdef CLOCK_MONOTONIC_RAW
     if (!clock_gettime( CLOCK_MONOTONIC_RAW, &ts ))
@@ -526,11 +531,6 @@ unsigned int get_tick_count(void)
 #endif
     if (!clock_gettime( CLOCK_MONOTONIC, &ts ))
         return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
-#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 / 1000000;
 #endif
     return (current_time - server_start_time) / 10000;
 }




More information about the wine-cvs mailing list