]> git.saurik.com Git - wxWidgets.git/commitdiff
timercmn rewritten from scratch
authorGuillermo Rodriguez Garcia <guille@iies.es>
Fri, 17 Dec 1999 01:28:44 +0000 (01:28 +0000)
committerGuillermo Rodriguez Garcia <guille@iies.es>
Fri, 17 Dec 1999 01:28:44 +0000 (01:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/timer.h

index 0a19282ecafae5bfad114e836db60e82ab3f7308..d33638a8c81331b958152637d063aa71d9c4d10a 100644 (file)
@@ -16,7 +16,9 @@
     #pragma interface "timerbase.h"
 #endif
 
+#include "wx/setup.h"
 #include "wx/object.h"
+#include "wx/longlong.h"
 
 // ----------------------------------------------------------------------------
 // wxTimer
@@ -99,62 +101,44 @@ class WXDLLEXPORT wxStopWatch
 {
 public: 
     // ctor starts the stop watch
-    wxStopWatch() { Start(); }
+    wxStopWatch()        { Start(); }
+    void Start(long t = 0);
+    inline void Pause()  { m_pause = GetElapsedTime(); }
+    inline void Resume() { Start(m_pause); }
 
-    void Start(long t = 0); // (re)start it t milliseconds ago
-    inline void Pause();
-    void Resume() { Start(m_pause); }
-
-    // get the elapsed time since the last Start() or Pause() in milliseconds
+    // get elapsed time since the last Start() or Pause() in milliseconds
     long Time() const;
 
 protected:
     // returns the elapsed time since t0
-    inline long GetElapsedTime() const;
+    long GetElapsedTime() const;
     
 private:
-    long m_t0;          // the time of the last Start()
-    long m_pause;       // the time of the last Pause() or 0
+    wxLongLong m_t0;      // the time of the last Start()
+    long m_pause;         // the time of the last Pause() or 0
 };
 
-// the old name
-#ifdef WXWIN_COMPATIBILITY_2
-    typedef wxStopWatch wxChrono;
-#endif // WXWIN_COMPATIBILITY_2
 
-// ----------------------------------------------------------------------------
-// global time functions
-// ----------------------------------------------------------------------------
-
-// Timer functions (milliseconds) -- use wxStopWatch instead
+// Starts a global timer 
+// -- DEPRECATED: use wxStopWatch instead
 void WXDLLEXPORT wxStartTimer();
 
-// Gets time since last wxStartTimer or wxGetElapsedTime -- use wxStopWatch
-// instead
+// Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime
+// -- DEPRECATED: use wxStopWatch instead
 long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE);
 
-// Get the local time
-bool WXDLLEXPORT wxGetLocalTime(long *timeZone, int *dstObserved);
-
-// Get number of seconds since 00:00:00 GMT, Jan 1st 1970.
-long WXDLLEXPORT wxGetCurrentTime();
-
-// Get number of milliseconds since 00:00:00 GMT, Jan 1st 1970.
-long WXDLLEXPORT wxGetCurrentMTime();
 
 // ----------------------------------------------------------------------------
-// inline functions
+// global time functions
 // ----------------------------------------------------------------------------
 
-inline long wxStopWatch::GetElapsedTime() const
-{
-    return wxGetCurrentMTime() - m_t0;
-}
+// Get number of seconds since local time 00:00:00 Jan 1st 1970.
+long WXDLLEXPORT wxGetLocalTime();
+
+// Get number of seconds since GMT 00:00:00, Jan 1st 1970.
+long WXDLLEXPORT wxGetUTCTime();
+
 
-inline void wxStopWatch::Pause()
-{
-    m_pause = GetElapsedTime();
-}
 
 #endif
     // _WX_TIMER_H_BASE_