X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f7d8cefd72ea2b213af5a4a6f8b2fc41d350c9a5..06a32e049c1bad9249079ad2e91659303424a774:/src/unix/timerunx.cpp

diff --git a/src/unix/timerunx.cpp b/src/unix/timerunx.cpp
index bcdebf9167..7ee1177c89 100644
--- a/src/unix/timerunx.cpp
+++ b/src/unix/timerunx.cpp
@@ -31,6 +31,7 @@
 
 #include "wx/apptrait.h"
 #include "wx/longlong.h"
+#include "wx/time.h"
 #include "wx/vector.h"
 
 #include <sys/time.h>
@@ -54,7 +55,7 @@ static inline wxString wxUsecClockAsString(wxUsecClock_t usec)
     #if wxUSE_LONGLONG
         return usec.ToString();
     #else // wxUsecClock_t == double
-        return wxString::Format(_T("%.0f"), usec);
+        return wxString::Format(wxT("%.0f"), usec);
     #endif
 }
 
@@ -86,7 +87,7 @@ void wxTimerScheduler::DoAddTimer(wxTimerSchedule *s)
     for ( node = m_timers.begin(); node != m_timers.end(); ++node )
     {
         wxASSERT_MSG( (*node)->m_timer != s->m_timer,
-                      _T("adding the same timer twice?") );
+                      wxT("adding the same timer twice?") );
 
         if ( (*node)->m_expiration > s->m_expiration )
             break;
@@ -115,7 +116,7 @@ void wxTimerScheduler::RemoveTimer(wxUnixTimerImpl *timer)
         }
     }
 
-    wxFAIL_MSG( _T("removing inexistent timer?") );
+    wxFAIL_MSG( wxT("removing inexistent timer?") );
 }
 
 bool wxTimerScheduler::GetNext(wxUsecClock_t *remaining) const
@@ -123,9 +124,9 @@ bool wxTimerScheduler::GetNext(wxUsecClock_t *remaining) const
     if ( m_timers.empty() )
       return false;
 
-    wxCHECK_MSG( remaining, false, _T("NULL pointer") );
+    wxCHECK_MSG( remaining, false, wxT("NULL pointer") );
 
-    *remaining = (*m_timers.begin())->m_expiration - wxGetLocalTimeUsec();
+    *remaining = (*m_timers.begin())->m_expiration - wxGetUTCTimeUSec();
     if ( *remaining < 0 )
     {
         // timer already expired, don't wait at all before notifying it
@@ -140,7 +141,7 @@ bool wxTimerScheduler::NotifyExpired()
     if ( m_timers.empty() )
       return false;
 
-    const wxUsecClock_t now = wxGetLocalTimeUsec();
+    const wxUsecClock_t now = wxGetUTCTimeUSec();
 
     typedef wxVector<wxUnixTimerImpl *> TimerImpls;
     TimerImpls toNotify;
@@ -218,7 +219,7 @@ bool wxUnixTimerImpl::Start(int milliseconds, bool oneShot)
     // notice that this will stop an already running timer
     wxTimerImpl::Start(milliseconds, oneShot);
 
-    wxTimerScheduler::Get().AddTimer(this, wxGetLocalTimeUsec() + m_milli*1000);
+    wxTimerScheduler::Get().AddTimer(this, wxGetUTCTimeUSec() + m_milli*1000);
     m_isRunning = true;
 
     return true;
@@ -241,7 +242,7 @@ bool wxUnixTimerImpl::IsRunning() const
 
 wxUnixTimerImpl::~wxUnixTimerImpl()
 {
-    wxASSERT_MSG( !m_isRunning, _T("must have been stopped before") );
+    wxASSERT_MSG( !m_isRunning, wxT("must have been stopped before") );
 }
 
 // ============================================================================
@@ -264,21 +265,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxTimerUnixModule, wxModule)
 // global functions
 // ============================================================================
 
-wxUsecClock_t wxGetLocalTimeUsec()
-{
-#ifdef HAVE_GETTIMEOFDAY
-    struct timeval tv;
-    if ( wxGetTimeOfDay(&tv) != -1 )
-    {
-        wxUsecClock_t val = 1000000L; // usec/sec
-        val *= tv.tv_sec;
-        return val + tv.tv_usec;
-    }
-#endif // HAVE_GETTIMEOFDAY
-
-    return wxGetLocalTimeMillis() * 1000L;
-}
-
 wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer)
 {
     return new wxUnixTimerImpl(timer);