X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/faa80db058efda992c5b963912e5c14af71bd030..08f744fb3be54d7f13c265bc05d3c37fadf67b06:/src/unix/timerunx.cpp diff --git a/src/unix/timerunx.cpp b/src/unix/timerunx.cpp index e742b79486..d6ee503df5 100644 --- a/src/unix/timerunx.cpp +++ b/src/unix/timerunx.cpp @@ -29,6 +29,7 @@ #include "wx/event.h" #endif +#include "wx/apptrait.h" #include "wx/longlong.h" #include @@ -133,10 +134,12 @@ bool wxTimerScheduler::GetNext(wxUsecClock_t *remaining) const return true; } -void wxTimerScheduler::NotifyExpired() +bool wxTimerScheduler::NotifyExpired() { if ( m_timers.empty() ) - return; + return false; + + bool notified = false; const wxUsecClock_t now = wxGetLocalTimeUsec(); @@ -171,13 +174,20 @@ void wxTimerScheduler::NotifyExpired() } else // reschedule the next timer expiration { - s->m_expiration += timer->GetInterval()*1000; + // always keep the expiration time in the future, i.e. base it on + // the current time instead of just offsetting it from the current + // expiration time because it could happen that we're late and the + // current expiration time is (far) in the past + s->m_expiration = now + timer->GetInterval()*1000; DoAddTimer(s); } // and finally notify the timer timer->Notify(); + notified = true; } + + return notified; } // ============================================================================ @@ -256,5 +266,10 @@ wxUsecClock_t wxGetLocalTimeUsec() return wxGetLocalTimeMillis() * 1000L; } +wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer) +{ + return new wxUnixTimerImpl(timer); +} + #endif // wxUSE_TIMER