From 23582855f9af2b40f4ebb090074ea418ade61853 Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Sat, 25 Feb 2012 05:47:57 +0000 Subject: [PATCH] Implementing the monotonic clock if available, per e-mail from Phil Vandry dated 2/17/12 at 5:08 PM git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1079 7f0cb862-5218-0410-a997-914c9d46530a --- src/x11/freeglut_main_x11.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/x11/freeglut_main_x11.c b/src/x11/freeglut_main_x11.c index 33553e3..75bc54c 100644 --- a/src/x11/freeglut_main_x11.c +++ b/src/x11/freeglut_main_x11.c @@ -91,11 +91,17 @@ void fgPlatformDisplayWindow ( SFG_Window *window ) unsigned long fgPlatformSystemTime ( void ) { +#ifdef CLOCK_MONOTONIC + struct timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + return now.tv_nsec/1000000 + now.tv_sec*1000; +#else #ifdef HAVE_GETTIMEOFDAY struct timeval now; gettimeofday( &now, NULL ); return now.tv_usec/1000 + now.tv_sec*1000; #endif +#endif } /* -- 1.7.10.4