]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stopwatch.cpp
Update version to 2.9.4 in version.bkl too and rebake everything.
[wxWidgets.git] / src / common / stopwatch.cpp
index f077378b3abaf5762e031d960d58e4a75a3000a3..f36696dff0b9ce5053dfa785446d1109c0db4903 100644 (file)
@@ -37,6 +37,7 @@
         #include "wx/msw/wrapwin.h"
     #endif
     #include "wx/log.h"
+    #include "wx/thread.h"
 #endif //WX_PRECOMP
 
 // ============================================================================
@@ -64,7 +65,7 @@ struct PerfCounter
         return freq.QuadPart != 0;
     }
 
-    wxCriticalSection cs;
+    wxCRIT_SECT_DECLARE_MEMBER(cs);
     LARGE_INTEGER freq;
     bool init;
 } gs_perfCounter;
@@ -82,7 +83,7 @@ void wxStopWatch::DoStart()
 #ifdef __WXMSW__
     if ( !gs_perfCounter.init )
     {
-        wxCriticalSectionLocker lock(gs_perfCounter.cs);
+        wxCRIT_SECT_LOCKER(lock, gs_perfCounter.cs);
         ::QueryPerformanceFrequency(&gs_perfCounter.freq);
 
         // Just a sanity check: it's not supposed to happen but verify that
@@ -125,6 +126,10 @@ wxLongLong wxStopWatch::GetClockFreq() const
 
 void wxStopWatch::Start(long t0)
 {
+    // Calling Start() makes the stop watch run however many times it was
+    // paused before.
+    m_pauseCount = 0;
+
     DoStart();
 
     m_t0 -= (wxLongLong(t0)*GetClockFreq())/MILLISECONDS_PER_SECOND;