From: <fa...@us...> - 2012-02-25 05:48:04
|
Revision: 1079 http://freeglut.svn.sourceforge.net/freeglut/?rev=1079&view=rev Author: fayjf Date: 2012-02-25 05:47:57 +0000 (Sat, 25 Feb 2012) Log Message: ----------- Implementing the monotonic clock if available, per e-mail from Phil Vandry dated 2/17/12 at 5:08 PM Modified Paths: -------------- trunk/freeglut/freeglut/src/x11/freeglut_main_x11.c Modified: trunk/freeglut/freeglut/src/x11/freeglut_main_x11.c =================================================================== --- trunk/freeglut/freeglut/src/x11/freeglut_main_x11.c 2012-02-25 05:34:24 UTC (rev 1078) +++ trunk/freeglut/freeglut/src/x11/freeglut_main_x11.c 2012-02-25 05:47:57 UTC (rev 1079) @@ -91,11 +91,17 @@ 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 } /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |