X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2286341c8d8c72b3eb65ffe23cfc8756f841b1c3..7d56fb8fcdb469bdef549319b2d81ab4b02b5a67:/src/common/timercmn.cpp diff --git a/src/common/timercmn.cpp b/src/common/timercmn.cpp index 2a17f8cf23..c350e8ca5b 100644 --- a/src/common/timercmn.cpp +++ b/src/common/timercmn.cpp @@ -11,7 +11,7 @@ // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem // (c) 1999 Guillermo Rodriguez -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -57,6 +57,12 @@ #include #endif +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent) + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -72,11 +78,29 @@ #endif #endif // HAVE_GETTIMEOFDAY +// ---------------------------------------------------------------------------- +// prototypes +// ---------------------------------------------------------------------------- + +wxLongLong wxGetLocalTimeMillis(); + // ============================================================================ // implementation // ============================================================================ -wxLongLong wxGetLocalTimeMillis(); +// ---------------------------------------------------------------------------- +// wxTimerBase +// ---------------------------------------------------------------------------- + +void wxTimerBase::Notify() +{ + // the base class version generates an event if it has owner - which it + // should because otherwise nobody can process timer events + wxCHECK_RET( m_owner, _T("wxTimer::Notify() should be overridden.") ); + + wxTimerEvent event(m_idTimer, m_milli); + (void)m_owner->ProcessEvent(event); +} // ---------------------------------------------------------------------------- // wxStopWatch @@ -89,7 +113,7 @@ void wxStopWatch::Start(long t) m_pause = 0; } -inline long wxStopWatch::GetElapsedTime() const +long wxStopWatch::GetElapsedTime() const { return (wxGetLocalTimeMillis() - m_t0).GetLo(); } @@ -221,6 +245,10 @@ wxLongLong wxGetLocalTimeMillis() SYSTEMTIME st; ::GetLocalTime(&st); return (val + st.wMilliseconds); +#elif defined(__VISAGECPP__) + DATETIME dt; + ::DosGetDateTime(&dt); + return (val + dt.hundredths*10); #elif defined(HAVE_GETTIMEOFDAY) struct timeval tp; if ( wxGetTimeOfDay(&tp, (struct timezone *)NULL) != -1 ) @@ -234,7 +262,9 @@ wxLongLong wxGetLocalTimeMillis() return (val + tp.millitm); } #else +#if !defined(__BORLANDC__) && !(defined(__VISUALC__) && defined(__WIN16__)) #warning "wxStopWatch will be up to second resolution!" +#endif #endif return val;