]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/stopwatch.h
test whether pointer is non-NULL before using it, not after, in wxAnimation::Load...
[wxWidgets.git] / include / wx / stopwatch.h
index dcb5542f20890ee77ba0edaa3ff863bf61ba615a..cc12e772a0ae3a6e298f8612011a145c7990fb0b 100644 (file)
@@ -32,7 +32,7 @@ public:
     // pause the stop watch
     void Pause()
     {
-        if ( !m_pauseCount++ )
+        if ( m_pauseCount++ == 0 )
             m_pause = GetElapsedTime();
     }
 
@@ -42,7 +42,7 @@ public:
         wxASSERT_MSG( m_pauseCount > 0,
                       _T("Resuming stop watch which is not paused") );
 
-        if ( !--m_pauseCount )
+        if ( --m_pauseCount == 0 )
             Start(m_pause);
     }
 
@@ -99,4 +99,14 @@ extern wxMilliClock_t WXDLLIMPEXP_BASE wxGetLocalTimeMillis();
 
 #define wxGetCurrentTime() wxGetLocalTime()
 
+// on some really old systems gettimeofday() doesn't have the second argument,
+// define wxGetTimeOfDay() to hide this difference
+#ifdef HAVE_GETTIMEOFDAY
+    #ifdef WX_GETTIMEOFDAY_NO_TZ
+        #define wxGetTimeOfDay(tv)      gettimeofday(tv)
+    #else
+        #define wxGetTimeOfDay(tv)      gettimeofday((tv), NULL)
+    #endif
+#endif // HAVE_GETTIMEOFDAY
+
 #endif // _WX_STOPWATCH_H_