]> Dogcows Code - chaz/yoink/blobdiff - src/moof/timer.cc
resource loading bugs and new sound class
[chaz/yoink] / src / moof / timer.cc
index b5c55ff528f6f3c6205afbb128a8615acc882f09..89f3e9da825676ef16e8ad94086e52f91615af74 100644 (file)
@@ -9,7 +9,7 @@
 *
 **************************************************************************/
 
-#include "../config.h"
+#include "config.h"
 
 #include <cerrno>
 #include <ctime>
@@ -113,7 +113,7 @@ scalar timer::find_next_expiration()
        scalar next_fire = std::numeric_limits<scalar>::max();
 
        hash<unsigned,timer*,hash_function>::iterator it;
-       for (it = timers_.begin(); it != timers_.end(); ++it)
+       for (it = timers_.begin(); it.valid(); ++it)
        {
                scalar absolute = (*it).second->absolute_;
                if (absolute < next_fire) next_fire = absolute;
@@ -149,15 +149,17 @@ void timer::fire_expired_timers(scalar t)
        if (next_expiration_ > t) return;
 
        hash<unsigned,timer*,hash_function>::iterator it;
-       for (it = timers_.begin(); it != timers_.end(); ++it)
+       for (it = timers_.begin(); it.valid(); ++it)
        {
                timer* timer = (*it).second;
                if (timer->is_expired()) timer->fire();
+
+               if (it.end()) break;
        }
 }
 
 
-#if HAVE_CLOCK_GETTIME
+#if USE_CLOCK_GETTIME
 
 // Since the monotonic clock will provide us with the time since the
 // computer started, the number of seconds since that time could easily
@@ -209,7 +211,7 @@ void timer::sleep(scalar seconds, mode mode)
 }
 
 
-#else // ! HAVE_CLOCK_GETTIME
+#else // ! USE_CLOCK_GETTIME
 
 
 // If we don't have posix timers, we'll have to use a different timing
@@ -228,7 +230,7 @@ void timer::sleep(scalar seconds, mode mode)
        SDL_Delay(Uint32(clamp(int(seconds * 1000.0), 0, 1000)));
 }
 
-#endif // HAVE_CLOCK_GETTIME
+#endif // USE_CLOCK_GETTIME
 
 
 } // namespace moof
This page took 0.022691 seconds and 4 git commands to generate.