Implementing the monotonic clock if available, per e-mail from Phil Vandry dated 2/17/12 at 5:08 PM

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1079 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2012-02-25 05:47:57 +00:00
parent 84d7d3bf86
commit 9c6c6850d0

View File

@ -91,11 +91,17 @@ void fgPlatformDisplayWindow ( SFG_Window *window )
unsigned long fgPlatformSystemTime ( void ) 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 #ifdef HAVE_GETTIMEOFDAY
struct timeval now; struct timeval now;
gettimeofday( &now, NULL ); gettimeofday( &now, NULL );
return now.tv_usec/1000 + now.tv_sec*1000; return now.tv_usec/1000 + now.tv_sec*1000;
#endif #endif
#endif
} }
/* /*