server: Use the monotonic time counter also on the server side.

This commit is contained in:
Alexandre Julliard 2013-01-30 12:49:33 +01:00
parent a8df9b14ad
commit a74dc1a119
2 changed files with 20 additions and 3 deletions

View File

@ -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

View File

@ -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;
}