X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Ftimer.cc;h=89f3e9da825676ef16e8ad94086e52f91615af74;hp=b5c55ff528f6f3c6205afbb128a8615acc882f09;hb=c143f7e806766a73cd69dc6e084e977641019ce6;hpb=449366f5f32d24f2a2a6589da6e16b2bf0d61773 diff --git a/src/moof/timer.cc b/src/moof/timer.cc index b5c55ff..89f3e9d 100644 --- a/src/moof/timer.cc +++ b/src/moof/timer.cc @@ -9,7 +9,7 @@ * **************************************************************************/ -#include "../config.h" +#include "config.h" #include #include @@ -113,7 +113,7 @@ scalar timer::find_next_expiration() scalar next_fire = std::numeric_limits::max(); hash::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::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