]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stopwatch.cpp
Override MSWTranslateMessage for wxActiveXContainer. Calling IOleInPlaceActiveObject...
[wxWidgets.git] / src / common / stopwatch.cpp
index 476237c9cf18376f3d37dde4f653ded78ed54f32..f077378b3abaf5762e031d960d58e4a75a3000a3 100644 (file)
@@ -112,8 +112,15 @@ wxLongLong wxStopWatch::GetClockFreq() const
         return gs_perfCounter.freq.QuadPart;
 #endif // __WXMSW__
 
+#ifdef HAVE_GETTIMEOFDAY
+    // With gettimeofday() we can have nominally microsecond precision and
+    // while this is not the case in practice, it's still better than
+    // millisecond.
+    return MICROSECONDS_PER_SECOND;
+#else // !HAVE_GETTIMEOFDAY
     // Currently milliseconds are used everywhere else.
     return MILLISECONDS_PER_SECOND;
+#endif // HAVE_GETTIMEOFDAY/!HAVE_GETTIMEOFDAY
 }
 
 void wxStopWatch::Start(long t0)
@@ -134,7 +141,11 @@ wxLongLong wxStopWatch::GetCurrentClockValue() const
     }
 #endif // __WXMSW__
 
-    return wxGetLocalTimeMillis();
+#ifdef HAVE_GETTIMEOFDAY
+    return wxGetUTCTimeUSec();
+#else // !HAVE_GETTIMEOFDAY
+    return wxGetUTCTimeMillis();
+#endif // HAVE_GETTIMEOFDAY/!HAVE_GETTIMEOFDAY
 }
 
 wxLongLong wxStopWatch::TimeInMicro() const
@@ -158,14 +169,14 @@ static wxLongLong wxStartTime = 0l;
 // starts the global timer
 void wxStartTimer()
 {
-    wxStartTime = wxGetLocalTimeMillis();
+    wxStartTime = wxGetUTCTimeMillis();
 }
 
 // Returns elapsed time in milliseconds
 long wxGetElapsedTime(bool resetTimer)
 {
     wxLongLong oldTime = wxStartTime;
-    wxLongLong newTime = wxGetLocalTimeMillis();
+    wxLongLong newTime = wxGetUTCTimeMillis();
 
     if ( resetTimer )
         wxStartTime = newTime;