fixed bad overflow bug in wxX11 timer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
92ee0ef908
commit
9750481f36
@ -41,12 +41,13 @@
|
|||||||
// if we are unlucky and the latter combines information from two sources.
|
// if we are unlucky and the latter combines information from two sources.
|
||||||
#include "wx/mgl/private.h"
|
#include "wx/mgl/private.h"
|
||||||
extern "C" ulong _EVT_getTicks();
|
extern "C" ulong _EVT_getTicks();
|
||||||
#define GetMillisecondsTime() _EVT_getTicks()
|
#define GetMillisecondsTime _EVT_getTicks
|
||||||
|
|
||||||
|
typedef ulong wxTimerTick_t;
|
||||||
#else
|
#else
|
||||||
// #define GetMillisecondsTime() wxGetLocalTimeMillis().ToLong()
|
#define GetMillisecondsTime wxGetLocalTimeMillis
|
||||||
// Suppresses the debug warning in ToLong. FIXME: check
|
|
||||||
// that we don't drastically lose precision
|
typedef wxLongLong wxTimerTick_t;
|
||||||
#define GetMillisecondsTime() (unsigned long) wxGetLocalTimeMillis().GetValue()
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -72,7 +73,7 @@ class wxTimerScheduler
|
|||||||
public:
|
public:
|
||||||
wxTimerScheduler() : m_timers(NULL) {}
|
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 RemoveTimer(wxTimerDesc *desc);
|
||||||
void NotifyTimers();
|
void NotifyTimers();
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ private:
|
|||||||
wxTimerDesc *m_timers;
|
wxTimerDesc *m_timers;
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxTimerScheduler::QueueTimer(wxTimerDesc *desc, unsigned long when)
|
void wxTimerScheduler::QueueTimer(wxTimerDesc *desc, wxTimerTick_t when)
|
||||||
{
|
{
|
||||||
if ( desc->running )
|
if ( desc->running )
|
||||||
return; // already scheduled
|
return; // already scheduled
|
||||||
@ -128,7 +129,7 @@ void wxTimerScheduler::NotifyTimers()
|
|||||||
{
|
{
|
||||||
bool oneShot;
|
bool oneShot;
|
||||||
volatile bool timerDeleted;
|
volatile bool timerDeleted;
|
||||||
unsigned long now = GetMillisecondsTime();
|
wxTimerTick_t now = GetMillisecondsTime();
|
||||||
wxTimerDesc *desc;
|
wxTimerDesc *desc;
|
||||||
|
|
||||||
while ( m_timers && m_timers->shotTime <= now )
|
while ( m_timers && m_timers->shotTime <= now )
|
||||||
|
Loading…
Reference in New Issue
Block a user