From 9750481f368dceba820004ab479d31deb4860253 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 19 Mar 2003 16:57:30 +0000 Subject: [PATCH] fixed bad overflow bug in wxX11 timer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/timer.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/generic/timer.cpp b/src/generic/timer.cpp index 97ac996536..640ddfe53d 100644 --- a/src/generic/timer.cpp +++ b/src/generic/timer.cpp @@ -41,12 +41,13 @@ // if we are unlucky and the latter combines information from two sources. #include "wx/mgl/private.h" extern "C" ulong _EVT_getTicks(); - #define GetMillisecondsTime() _EVT_getTicks() + #define GetMillisecondsTime _EVT_getTicks + + typedef ulong wxTimerTick_t; #else -// #define GetMillisecondsTime() wxGetLocalTimeMillis().ToLong() - // Suppresses the debug warning in ToLong. FIXME: check - // that we don't drastically lose precision - #define GetMillisecondsTime() (unsigned long) wxGetLocalTimeMillis().GetValue() + #define GetMillisecondsTime wxGetLocalTimeMillis + + typedef wxLongLong wxTimerTick_t; #endif // ---------------------------------------------------------------------------- @@ -72,7 +73,7 @@ class wxTimerScheduler public: wxTimerScheduler() : m_timers(NULL) {} - void QueueTimer(wxTimerDesc *desc, unsigned long when = 0); + void QueueTimer(wxTimerDesc *desc, wxTimerTick_t when = 0); void RemoveTimer(wxTimerDesc *desc); void NotifyTimers(); @@ -80,7 +81,7 @@ private: wxTimerDesc *m_timers; }; -void wxTimerScheduler::QueueTimer(wxTimerDesc *desc, unsigned long when) +void wxTimerScheduler::QueueTimer(wxTimerDesc *desc, wxTimerTick_t when) { if ( desc->running ) return; // already scheduled @@ -128,7 +129,7 @@ void wxTimerScheduler::NotifyTimers() { bool oneShot; volatile bool timerDeleted; - unsigned long now = GetMillisecondsTime(); + wxTimerTick_t now = GetMillisecondsTime(); wxTimerDesc *desc; while ( m_timers && m_timers->shotTime <= now ) -- 2.50.0