X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Ftimer.cc;h=d73d94f1bbedb7d11c0d9bc76a558a316d26d05c;hp=de601ee5db999fa8e54ce456ac7a840216565bbb;hb=3e195be39157284a7f05b23a8a635adf26c10ee4;hpb=e1a8eee026993b860c557c87ec559c902a4b6a11 diff --git a/src/timer.cc b/src/timer.cc index de601ee..d73d94f 100644 --- a/src/timer.cc +++ b/src/timer.cc @@ -30,20 +30,24 @@ #include #include +#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 @@ -88,7 +93,7 @@ scalar ticks() } -#endif // HAVE_LIBRT +#endif // HAVE_CLOCK_GETTIME void sleep(scalar seconds, bool absolute)