]> Dogcows Code - chaz/yoink/commitdiff
the posix timer is now accessible again
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sun, 26 Jul 2009 02:11:36 +0000 (20:11 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sun, 26 Jul 2009 02:11:36 +0000 (20:11 -0600)
configure.ac
src/timer.cc

index c5ac1f048170e206ca6eaa05bc8f9187b3cd5671..7b40bb30789a297dee79d9e985d9c587a8003213 100644 (file)
@@ -102,8 +102,8 @@ AC_SEARCH_LIBS([glBegin], [GL],,
                           [AC_MSG_ERROR([libGL is required])])
 
 AC_SEARCH_LIBS([clock_gettime], [rt],
-                          [AC_DEFINE([HAVE_LIBRT], 1,
-                                                 [Define to 1 if you have the 'rt' library.])])
+                          [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
+                                                 [Define to 1 if you have the 'clock_gettime' function.])])
 
 
 #
@@ -135,7 +135,7 @@ AC_TYPE_SSIZE_T
 
 AC_FUNC_ERROR_AT_LINE
 AC_FUNC_STRTOD
-AC_CHECK_FUNCS([strchr strcspn strrchr strstr])
+AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
 
 
 #
index de601ee5db999fa8e54ce456ac7a840216565bbb..d73d94f1bbedb7d11c0d9bc76a558a316d26d05c 100644 (file)
 #include <ctime>
 #include <cerrno>
 
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "timer.hh"
 
 
 namespace dc {
 
 
-#if HAVE_LIBRT
+#if HAVE_CLOCK_GETTIME
 
 // Since the monotonic clock will provide us with the timer since the computer
 // started, the number of seconds since that time could easily become so large
 // that it cannot be accurately stored in a float (even with as little two days
-// update), therefore we need to start from a more recent reference (when the
+// uptime), therefore we need to start from a more recent reference (when the
 // program starts).  Of course this isn't much of an issue if scalar is a
-// double-precious number.
+// double-precision number.
 
 static time_t setReference()
 {
@@ -73,11 +77,12 @@ scalar ticks()
 }
 
 
-#else // ! HAVE_LIBRT
+#else // ! HAVE_CLOCK_GETTIME
 
 
-// If we don't have librt, we'll have to use a different timing method.  SDL
-// only promises centisecond accuracy, but it may be better than nothing.
+// If we don't have posix timers, we'll have to use a different timing method.
+// SDL only promises centisecond accuracy, but that's better than a kick in the
+// butt.
 
 #include <SDL/SDL.h>
 
@@ -88,7 +93,7 @@ scalar ticks()
 }
 
 
-#endif // HAVE_LIBRT
+#endif // HAVE_CLOCK_GETTIME
 
 
 void sleep(scalar seconds, bool absolute)
This page took 0.026139 seconds and 4 git commands to generate.