Module: wine Branch: master Commit: a74dc1a1195b38e0e04798799229a3aab8a021ef URL: http://source.winehq.org/git/wine.git/?a=commit;h=a74dc1a1195b38e0e047987992...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jan 30 12:49:33 2013 +0100
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 a2f1a52..2e9bba1 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 8d6a7f9..eeb3476 100644 --- a/server/request.c +++ b/server/request.c @@ -51,6 +51,9 @@ #ifdef HAVE_POLL_H #include <poll.h> #endif +#ifdef __APPLE__ +# include <mach/mach_time.h> +#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; }