X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b8f049904074a64d799709686ebc7a4576683314..cf471cab8277f4cc2c19bce417356badf9e2ca49:/src/common/timercmn.cpp diff --git a/src/common/timercmn.cpp b/src/common/timercmn.cpp index c96067d1d2..15d1abc07e 100644 --- a/src/common/timercmn.cpp +++ b/src/common/timercmn.cpp @@ -1,13 +1,16 @@ ///////////////////////////////////////////////////////////////////////////// // Name: common/timercmn.cpp // Purpose: Common timer implementation -// Author: Julian Smart -// Modified by: Vadim Zeitlin on 12.11.99 to get rid of all ifdefs -// Sylvain Bougnoux on ?? to add wxStopWatch class -// Guillermo Rodriguez , 12/99 complete rewrite. +// Author: +// Original version by Julian Smart +// Vadim Zeitlin got rid of all ifdefs (11.12.99) +// Sylvain Bougnoux added wxStopWatch class +// Guillermo Rodriguez rewrote from scratch (Dic/99) +// Modified by: // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem +// (c) 1999 Guillermo Rodriguez // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -86,21 +89,21 @@ void wxStopWatch::Start(long t) m_pause = 0; } -long wxStopWatch::Time() const +inline long wxStopWatch::GetElapsedTime() const { - return (m_pause ? m_pause : GetElapsedTime()); + return (wxGetLocalTimeMillis() - m_t0).GetLo(); } -long wxStopWatch::GetElapsedTime() const +long wxStopWatch::Time() const { - return (wxGetLocalTimeMillis() - m_t0).GetLo(); + return (m_pause ? m_pause : GetElapsedTime()); } // ---------------------------------------------------------------------------- // old timer functions superceded by wxStopWatch // ---------------------------------------------------------------------------- -static wxLongLong wxStartTime = 0; +static wxLongLong wxStartTime = 0l; // starts the global timer void wxStartTimer() @@ -208,7 +211,8 @@ wxLongLong wxGetLocalTimeMillis() // 00:00:00 Jan 1st 1970 and then whatever is available // to get millisecond resolution. // - wxLongLong val = 1000 * wxGetLocalTime(); + wxLongLong val = 1000l; + val *= wxGetLocalTime(); // If we got here, do not fail even if we can't get // millisecond resolution. @@ -229,6 +233,8 @@ wxLongLong wxGetLocalTimeMillis() { return (val + tp.millitm); } +#else +#warning "wxStopWatch will be up to second resolution!" #endif return val;