diff --git a/lib/base/timer.cpp b/lib/base/timer.cpp index cbb20ea39..0b56321f7 100644 --- a/lib/base/timer.cpp +++ b/lib/base/timer.cpp @@ -168,7 +168,7 @@ void Timer::Start() InitializeThread(); } - InternalRescheduleUnlocked(false); + InternalRescheduleUnlocked(false, m_Interval > 0 ? -1 : m_Next); } /** @@ -251,7 +251,7 @@ double Timer::GetNext() const } /** - * Adjusts all timers by adding the specified amount of time to their + * Adjusts all periodic timers by adding the specified amount of time to their * next scheduled timestamp. * * @param adjustment The adjustment. @@ -268,6 +268,11 @@ void Timer::AdjustTimers(double adjustment) std::vector timers; for (Timer *timer : idx) { + /* Don't schedule the next call if this is not a periodic timer. */ + if (timer->m_Interval <= 0) { + continue; + } + if (std::fabs(now - (timer->m_Next + adjustment)) < std::fabs(now - timer->m_Next)) { timer->m_Next += adjustment;