From a74dc1a1195b38e0e04798799229a3aab8a021ef Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 30 Jan 2013 12:49:33 +0100 Subject: [PATCH] server: Use the monotonic time counter also on the server side. --- server/Makefile.in | 6 +++--- server/request.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/server/Makefile.in b/server/Makefile.in index a2f1a52a060..2e9bba1fa82 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -1,5 +1,5 @@ DEFS = -D__WINESRC__ -EXTRALIBS = @LIBPOLL@ +EXTRALIBS = @LIBPOLL@ @LIBRT@ C_SRCS = \ async.c \ @@ -62,10 +62,10 @@ all: $(PROGRAMS) @MAKE_RULES@ wineserver: $(OBJS) - $(CC) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LIBS) $(LDRPATH_LOCAL) + $(CC) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(EXTRALIBS) $(LIBS) $(LDRPATH_LOCAL) wineserver-installed: $(OBJS) - $(CC) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LIBS) $(LDRPATH_INSTALL) + $(CC) -o $@ $(OBJS) $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(EXTRALIBS) $(LIBS) $(LDRPATH_INSTALL) install install-lib:: wineserver-installed $(DESTDIR)$(bindir) install-man-pages $(INSTALL_PROGRAM) wineserver-installed $(DESTDIR)$(bindir)/wineserver diff --git a/server/request.c b/server/request.c index 8d6a7f94c27..eeb34761f08 100644 --- a/server/request.c +++ b/server/request.c @@ -51,6 +51,9 @@ #ifdef HAVE_POLL_H #include #endif +#ifdef __APPLE__ +# include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -486,6 +489,20 @@ 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 + struct timespec ts; +#ifdef CLOCK_MONOTONIC_RAW + if (!clock_gettime( CLOCK_MONOTONIC_RAW, &ts )) + return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; +#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; }