aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/threads/Timer.cpp19
-rw-r--r--xbmc/threads/Timer.h1
2 files changed, 10 insertions, 10 deletions
diff --git a/xbmc/threads/Timer.cpp b/xbmc/threads/Timer.cpp
index 4709ee1705..e4b7709c90 100644
--- a/xbmc/threads/Timer.cpp
+++ b/xbmc/threads/Timer.cpp
@@ -22,7 +22,6 @@
#include "Timer.h"
#include "SystemClock.h"
-#include "utils/log.h"
CTimer::CTimer(ITimerCallback *callback)
: CThread("CTimer"),
@@ -40,15 +39,11 @@ CTimer::~CTimer()
bool CTimer::Start(uint32_t timeout, bool interval /* = false */)
{
if (m_callback == NULL || timeout == 0 || IsRunning())
- {
- CLog::Log(LOGWARNING, "CTimer: can't start timer");
return false;
- }
m_timeout = timeout;
m_interval = interval;
- CLog::Log(LOGDEBUG, "CTimer: starting for %d ms %s", m_timeout, m_interval ? "(interval)" : "");
Create();
return true;
}
@@ -58,7 +53,6 @@ bool CTimer::Stop(bool wait /* = false */)
if (!IsRunning())
return false;
- CLog::Log(LOGDEBUG, "CTimer: stopping %s", wait ? "(wait)" : "");
m_bStop = true;
m_eventTimeout.Set();
StopThread(wait);
@@ -66,6 +60,15 @@ bool CTimer::Stop(bool wait /* = false */)
return true;
}
+bool CTimer::Restart()
+{
+ if (!IsRunning())
+ return false;
+
+ Stop(true);
+ return Start(m_timeout, m_interval);
+}
+
float CTimer::GetElapsedSeconds() const
{
return GetElapsedMilliseconds() / 1000.0f;
@@ -92,7 +95,6 @@ void CTimer::Process()
currentTime = XbmcThreads::SystemClockMillis();
if (m_endTime <= currentTime)
{
- CLog::Log(LOGDEBUG, "CTimer: timeout");
// execute OnTimeout() callback
m_callback->OnTimeout();
@@ -100,11 +102,8 @@ void CTimer::Process()
if (!m_interval)
break;
- CLog::Log(LOGDEBUG, "CTimer: restart");
m_endTime = currentTime + m_timeout;
}
}
}
-
- CLog::Log(LOGDEBUG, "CTimer: finished");
} \ No newline at end of file
diff --git a/xbmc/threads/Timer.h b/xbmc/threads/Timer.h
index e6c98b9065..e94f2912ba 100644
--- a/xbmc/threads/Timer.h
+++ b/xbmc/threads/Timer.h
@@ -38,6 +38,7 @@ public:
bool Start(uint32_t timeout, bool interval = false);
bool Stop(bool wait = false);
+ bool Restart();
bool IsRunning() const { return CThread::IsRunning(); }