aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Carroll <thecarrolls@jiminger.com>2011-07-18 22:45:06 -0400
committerJim Carroll <thecarrolls@jiminger.com>2011-07-20 00:58:28 -0400
commit5b4f95309d1262391e5fb486cebee79f5eb4e3a3 (patch)
treeeebc5da3bbed27815be0c292a90e72c656c016a6
parent225797dcef584338086b8179ac32d4a1914e5d70 (diff)
Removed CTimeUtils::GetTimeMS and replaced it with XbmcThreads::SystemClockMillis rather than have two ways to access the same thing.
-rw-r--r--xbmc/Application.cpp11
-rw-r--r--xbmc/GUILargeTextureManager.cpp7
-rw-r--r--xbmc/InertialScrollingHandler.cpp3
-rw-r--r--xbmc/PartyModeManager.cpp5
-rw-r--r--xbmc/PlayListPlayer.cpp5
-rw-r--r--xbmc/SectionLoader.cpp9
-rw-r--r--xbmc/Util.cpp5
-rw-r--r--xbmc/cdrip/CDDARipper.cpp5
-rw-r--r--xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp3
-rw-r--r--xbmc/cores/AudioRenderers/NullDirectSound.cpp7
-rw-r--r--xbmc/cores/AudioRenderers/Win32DirectSound.cpp11
-rw-r--r--xbmc/cores/AudioRenderers/Win32WASAPI.cpp5
-rw-r--r--xbmc/cores/DummyVideoPlayer.cpp7
-rw-r--r--xbmc/cores/ExternalPlayer/ExternalPlayer.cpp7
-rw-r--r--xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp7
-rw-r--r--xbmc/cores/dvdplayer/DVDFileInfo.cpp5
-rw-r--r--xbmc/cores/dvdplayer/DVDMessage.cpp7
-rw-r--r--xbmc/cores/dvdplayer/DVDMessageTracker.cpp3
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayer.cpp7
-rw-r--r--xbmc/cores/paplayer/PAPlayer.cpp9
-rw-r--r--xbmc/dialogs/GUIDialogCache.cpp5
-rw-r--r--xbmc/filesystem/CacheCircular.cpp5
-rw-r--r--xbmc/filesystem/CacheMemBuffer.cpp5
-rw-r--r--xbmc/filesystem/CacheStrategy.cpp5
-rw-r--r--xbmc/filesystem/DllLibCurl.cpp9
-rw-r--r--xbmc/filesystem/FileCache.cpp11
-rw-r--r--xbmc/filesystem/FileSFTP.cpp17
-rw-r--r--xbmc/filesystem/FileShoutcast.cpp7
-rw-r--r--xbmc/filesystem/HDHomeRun.cpp5
-rw-r--r--xbmc/filesystem/HTSPDirectory.cpp5
-rw-r--r--xbmc/filesystem/MultiPathDirectory.cpp9
-rw-r--r--xbmc/filesystem/MusicSearchDirectory.cpp5
-rw-r--r--xbmc/filesystem/MythFile.cpp9
-rw-r--r--xbmc/filesystem/MythSession.cpp7
-rw-r--r--xbmc/filesystem/PluginDirectory.cpp11
-rw-r--r--xbmc/filesystem/SAPDirectory.cpp5
-rw-r--r--xbmc/input/linux/LIRC.cpp5
-rw-r--r--xbmc/input/windows/IRServerSuite.cpp7
-rw-r--r--xbmc/interfaces/http-api/XBMChttp.cpp5
-rw-r--r--xbmc/interfaces/python/XBPython.cpp5
-rw-r--r--xbmc/linux/XLCDproc.cpp3
-rw-r--r--xbmc/music/LastFmManager.cpp17
-rw-r--r--xbmc/music/MusicDatabase.cpp25
-rw-r--r--xbmc/music/infoscanner/MusicInfoScanner.cpp5
-rw-r--r--xbmc/music/karaoke/karaokelyricsmanager.cpp5
-rw-r--r--xbmc/music/windows/GUIWindowMusicBase.cpp9
-rw-r--r--xbmc/network/EventClient.cpp3
-rw-r--r--xbmc/network/UPnP.cpp5
-rw-r--r--xbmc/network/UdpClient.cpp7
-rw-r--r--xbmc/pictures/GUIWindowPictures.cpp5
-rw-r--r--xbmc/pictures/GUIWindowSlideShow.cpp5
-rw-r--r--xbmc/rendering/dx/RenderSystemDX.cpp3
-rw-r--r--xbmc/threads/Condition.h6
-rw-r--r--xbmc/threads/Makefile2
-rw-r--r--xbmc/threads/SystemClock.cpp (renamed from xbmc/threads/Time.cpp)2
-rw-r--r--xbmc/threads/SystemClock.h (renamed from xbmc/threads/Time.h)2
-rw-r--r--xbmc/threads/Thread.cpp5
-rw-r--r--xbmc/utils/AsyncFileCopy.cpp5
-rw-r--r--xbmc/utils/RssReader.cpp5
-rw-r--r--xbmc/utils/Stopwatch.cpp3
-rw-r--r--xbmc/utils/SystemInfo.cpp5
-rw-r--r--xbmc/utils/TimeUtils.cpp9
-rw-r--r--xbmc/utils/TimeUtils.h1
-rw-r--r--xbmc/video/Teletext.cpp7
-rw-r--r--xbmc/video/VideoDatabase.cpp47
-rw-r--r--xbmc/video/VideoInfoScanner.cpp5
-rw-r--r--xbmc/video/windows/GUIWindowFullScreen.cpp9
-rw-r--r--xbmc/windows/GUIMediaWindow.cpp5
68 files changed, 268 insertions, 212 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 473e6a92dd..23e6552fde 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "Application.h"
#include "interfaces/Builtins.h"
@@ -741,7 +742,7 @@ bool CApplication::Create()
g_mediaManager.Initialize();
- m_lastFrameTime = CTimeUtils::GetTimeMS();
+ m_lastFrameTime = XbmcThreads::SystemClockMillis();
m_lastRenderTime = m_lastFrameTime;
return Initialize();
@@ -1994,7 +1995,7 @@ void CApplication::Render()
lock.Leave();
- unsigned int now = CTimeUtils::GetTimeMS();
+ unsigned int now = XbmcThreads::SystemClockMillis();
if (hasRendered)
m_lastRenderTime = now;
@@ -2016,7 +2017,7 @@ void CApplication::Render()
if (frameTime < singleFrameTime)
Sleep(singleFrameTime - frameTime);
}
- m_lastFrameTime = CTimeUtils::GetTimeMS();
+ m_lastFrameTime = XbmcThreads::SystemClockMillis();
if (flip)
g_graphicsContext.Flip();
@@ -2554,7 +2555,7 @@ void CApplication::UpdateLCD()
long lTimeOut = 1000;
if ( m_iPlaySpeed != 1)
lTimeOut = 0;
- if ( ((long)CTimeUtils::GetTimeMS() - lTickCount) >= lTimeOut)
+ if ( ((long)XbmcThreads::SystemClockMillis() - lTickCount) >= lTimeOut)
{
if (g_application.NavigationIdleTime() < 5)
g_lcd->Render(ILCD::LCD_MODE_NAVIGATION);
@@ -2568,7 +2569,7 @@ void CApplication::UpdateLCD()
g_lcd->Render(ILCD::LCD_MODE_GENERAL);
// reset tick count
- lTickCount = CTimeUtils::GetTimeMS();
+ lTickCount = XbmcThreads::SystemClockMillis();
}
#endif
}
diff --git a/xbmc/GUILargeTextureManager.cpp b/xbmc/GUILargeTextureManager.cpp
index 8286486cff..ee1b438c7c 100644
--- a/xbmc/GUILargeTextureManager.cpp
+++ b/xbmc/GUILargeTextureManager.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "GUILargeTextureManager.h"
#include "pictures/Picture.h"
#include "settings/GUISettings.h"
@@ -58,14 +59,14 @@ bool CImageLoader::DoWork()
return false;
m_texture = new CTexture();
- DWORD start = CTimeUtils::GetTimeMS();
+ DWORD start = XbmcThreads::SystemClockMillis();
if (!m_texture->LoadFromFile(loadPath, min(g_graphicsContext.GetWidth(), 2048), min(g_graphicsContext.GetHeight(), 1080), g_guiSettings.GetBool("pictures.useexifrotation")))
{
delete m_texture;
m_texture = NULL;
}
- else if (CTimeUtils::GetTimeMS() - start > 100)
- CLog::Log(LOGDEBUG, "%s - took %d ms to load %s", __FUNCTION__, CTimeUtils::GetTimeMS() - start, loadPath.c_str());
+ else if (XbmcThreads::SystemClockMillis() - start > 100)
+ CLog::Log(LOGDEBUG, "%s - took %d ms to load %s", __FUNCTION__, XbmcThreads::SystemClockMillis() - start, loadPath.c_str());
}
return true;
diff --git a/xbmc/InertialScrollingHandler.cpp b/xbmc/InertialScrollingHandler.cpp
index 57f37a458b..e1274f2146 100644
--- a/xbmc/InertialScrollingHandler.cpp
+++ b/xbmc/InertialScrollingHandler.cpp
@@ -20,6 +20,7 @@
*/
+#include "threads/SystemClock.h"
#include "InertialScrollingHandler.h"
#include "Application.h"
#include "utils/TimeUtils.h"
@@ -106,7 +107,7 @@ bool CInertialScrollingHandler::ProcessInertialScroll(float frameTime)
//decrease based on negativ acceleration
//calc the overall inertial scrolling time in secs
- float absolutInertialTime = (CTimeUtils::GetTimeMS() - m_inertialStartTime)/(float)1000;
+ float absolutInertialTime = (XbmcThreads::SystemClockMillis() - m_inertialStartTime)/(float)1000;
//as long as we aren't over the overall inertial scroll time - do the deacceleration
if ( absolutInertialTime < TIME_TO_ZERO_SPEED + TIME_FOR_DEACELLERATION_DECREASE )
diff --git a/xbmc/PartyModeManager.cpp b/xbmc/PartyModeManager.cpp
index 6b28560792..f155b0fdb6 100644
--- a/xbmc/PartyModeManager.cpp
+++ b/xbmc/PartyModeManager.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "PartyModeManager.h"
#include "PlayListPlayer.h"
#include "music/MusicDatabase.h"
@@ -103,7 +104,7 @@ bool CPartyModeManager::Enable(PartyModeContext context /*= PARTYMODECONTEXT_MUS
pDialog->StartModal();
ClearState();
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
vector< pair<int,int> > songIDs;
if (m_type.Equals("songs") || m_type.Equals("mixed"))
{
@@ -187,7 +188,7 @@ bool CPartyModeManager::Enable(PartyModeContext context /*= PARTYMODECONTEXT_MUS
return false;
}
CLog::Log(LOGDEBUG, "%s time for song fetch: %u",
- __FUNCTION__, CTimeUtils::GetTimeMS() - time);
+ __FUNCTION__, XbmcThreads::SystemClockMillis() - time);
// start playing
g_playlistPlayer.SetCurrentPlaylist(iPlaylist);
diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp
index 2e49f9c64d..bd95db2ae5 100644
--- a/xbmc/PlayListPlayer.cpp
+++ b/xbmc/PlayListPlayer.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "PlayListPlayer.h"
#include "playlists/PlayListFactory.h"
#include "Application.h"
@@ -249,7 +250,7 @@ bool CPlayListPlayer::Play(int iSong, bool bAutoPlay /* = false */, bool bPlayPr
m_bPlaybackStarted = false;
- unsigned int playAttempt = CTimeUtils::GetTimeMS();
+ unsigned int playAttempt = XbmcThreads::SystemClockMillis();
if (!g_application.PlayFile(*item, bAutoPlay))
{
CLog::Log(LOGERROR,"Playlist Player: skipping unplayable item: %i, path [%s]", m_iCurrentSong, item->m_strPath.c_str());
@@ -260,7 +261,7 @@ bool CPlayListPlayer::Play(int iSong, bool bAutoPlay /* = false */, bool bPlayPr
m_failedSongsStart = playAttempt;
m_iFailedSongs++;
if ((m_iFailedSongs >= g_advancedSettings.m_playlistRetries && g_advancedSettings.m_playlistRetries >= 0)
- || ((CTimeUtils::GetTimeMS() - m_failedSongsStart >= (unsigned int)g_advancedSettings.m_playlistTimeout * 1000) && g_advancedSettings.m_playlistTimeout))
+ || ((XbmcThreads::SystemClockMillis() - m_failedSongsStart >= (unsigned int)g_advancedSettings.m_playlistTimeout * 1000) && g_advancedSettings.m_playlistTimeout))
{
CLog::Log(LOGDEBUG,"Playlist Player: one or more items failed to play... aborting playback");
diff --git a/xbmc/SectionLoader.cpp b/xbmc/SectionLoader.cpp
index 2f1e7424d6..f1f987094f 100644
--- a/xbmc/SectionLoader.cpp
+++ b/xbmc/SectionLoader.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "SectionLoader.h"
#include "cores/DllLoader/DllLoaderContainer.h"
@@ -111,7 +112,7 @@ void CSectionLoader::Unload(const CStdString& strSection)
section.m_lReferenceCount--;
if ( 0 == section.m_lReferenceCount)
{
- section.m_unloadDelayStartTick = CTimeUtils::GetTimeMS();
+ section.m_unloadDelayStartTick = XbmcThreads::SystemClockMillis();
return ;
}
}
@@ -166,7 +167,7 @@ void CSectionLoader::UnloadDLL(const CStdString &dllname)
if (0 == dll.m_lReferenceCount)
{
if (dll.m_bDelayUnload)
- dll.m_unloadDelayStartTick = CTimeUtils::GetTimeMS();
+ dll.m_unloadDelayStartTick = XbmcThreads::SystemClockMillis();
else
{
CLog::Log(LOGDEBUG,"SECTION:UnloadDll(%s)", dllname.c_str());
@@ -189,7 +190,7 @@ void CSectionLoader::UnloadDelayed()
while( i != g_sectionLoader.m_vecLoadedSections.end() )
{
CSection& section = *i;
- if( section.m_lReferenceCount == 0 && CTimeUtils::GetTimeMS() - section.m_unloadDelayStartTick > UNLOAD_DELAY)
+ if( section.m_lReferenceCount == 0 && XbmcThreads::SystemClockMillis() - section.m_unloadDelayStartTick > UNLOAD_DELAY)
{
CLog::Log(LOGDEBUG,"SECTION:UnloadDelayed(SECTION: %s)", section.m_strSectionName.c_str());
#ifdef HAS_SECTIONS
@@ -205,7 +206,7 @@ void CSectionLoader::UnloadDelayed()
for (int i = 0; i < (int)g_sectionLoader.m_vecLoadedDLLs.size(); ++i)
{
CDll& dll = g_sectionLoader.m_vecLoadedDLLs[i];
- if (dll.m_lReferenceCount == 0 && CTimeUtils::GetTimeMS() - dll.m_unloadDelayStartTick > UNLOAD_DELAY)
+ if (dll.m_lReferenceCount == 0 && XbmcThreads::SystemClockMillis() - dll.m_unloadDelayStartTick > UNLOAD_DELAY)
{
CLog::Log(LOGDEBUG,"SECTION:UnloadDelayed(DLL: %s)", dll.m_strDllName.c_str());
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index 99f6700873..97750ee04c 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -18,6 +18,7 @@
* http://www.gnu.org/copyleft/gpl.html
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#ifdef __APPLE__
#include <sys/param.h>
@@ -2205,7 +2206,7 @@ CStdString CUtil::GetFrameworksPath(bool forPython)
void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CStdString>& vecSubtitles )
{
- unsigned int startTimer = CTimeUtils::GetTimeMS();
+ unsigned int startTimer = XbmcThreads::SystemClockMillis();
// new array for commons sub dirs
const char * common_sub_dirs[] = {"subs",
@@ -2389,7 +2390,7 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt
delete pStream;
}
}
- CLog::Log(LOGDEBUG,"%s: END (total time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - startTimer));
+ CLog::Log(LOGDEBUG,"%s: END (total time: %i ms)", __FUNCTION__, (int)(XbmcThreads::SystemClockMillis() - startTimer));
}
int CUtil::ScanArchiveForSubtitles( const CStdString& strArchivePath, const CStdString& strMovieFileNameNoExt, std::vector<CStdString>& vecSubtitles )
diff --git a/xbmc/cdrip/CDDARipper.cpp b/xbmc/cdrip/CDDARipper.cpp
index ca3b95ac26..8ada0f7302 100644
--- a/xbmc/cdrip/CDDARipper.cpp
+++ b/xbmc/cdrip/CDDARipper.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#ifdef HAS_CDDA_RIPPER
@@ -316,7 +317,7 @@ bool CCDDARipper::RipCD()
// construct filename
CStdString strFile = URIUtils::AddFileToFolder(strDirectory, CUtil::MakeLegalFileName(GetTrackName(item.get()), legalType));
- unsigned int tick = CTimeUtils::GetTimeMS();
+ unsigned int tick = XbmcThreads::SystemClockMillis();
// don't rip non cdda items
if (item->m_strPath.Find(".cdda") < 0)
@@ -326,7 +327,7 @@ bool CCDDARipper::RipCD()
if (!Rip(item->m_strPath, strFile.c_str(), *item->GetMusicInfoTag()))
return false;
- tick = CTimeUtils::GetTimeMS() - tick;
+ tick = XbmcThreads::SystemClockMillis() - tick;
CLog::Log(LOGINFO, "Ripping Track %d took %s", i, StringUtils::SecondsToTimeString(tick / 1000).c_str());
}
diff --git a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp
index f6ca84507d..e23ed413e4 100644
--- a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp
+++ b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp
@@ -21,6 +21,7 @@
*/
#if !defined(__arm__)
+#include "threads/SystemClock.h"
#include <CoreServices/CoreServices.h>
#include "CoreAudioRenderer.h"
@@ -284,7 +285,7 @@ void CCoreAudioPerformance::ReportData(UInt32 bytesIn, UInt32 bytesOut)
return;
// Perform watchdog funtions
- UInt32 time = CTimeUtils::GetTimeMS();
+ UInt32 time = XbmcThreads::SystemClockMillis();
if (!m_LastWatchdogCheck)
m_LastWatchdogCheck = time;
UInt32 deltaTime = time - m_LastWatchdogCheck;
diff --git a/xbmc/cores/AudioRenderers/NullDirectSound.cpp b/xbmc/cores/AudioRenderers/NullDirectSound.cpp
index 9b19d47fbf..d53237904f 100644
--- a/xbmc/cores/AudioRenderers/NullDirectSound.cpp
+++ b/xbmc/cores/AudioRenderers/NullDirectSound.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "NullDirectSound.h"
#include "guilib/AudioContext.h"
#include "utils/log.h"
@@ -55,7 +56,7 @@ bool CNullDirectSound::Initialize(IAudioCallback* pCallback, const CStdString& d
m_timePerPacket = 1.0f / (float)(iChannels*(uiBitsPerSample/8) * uiSamplesPerSec);
m_packetsSent = 0;
m_paused = 0;
- m_lastUpdate = CTimeUtils::GetTimeMS();
+ m_lastUpdate = XbmcThreads::SystemClockMillis();
return true;
}
@@ -75,7 +76,7 @@ bool CNullDirectSound::Deinitialize()
void CNullDirectSound::Flush()
{
- m_lastUpdate = CTimeUtils::GetTimeMS();
+ m_lastUpdate = XbmcThreads::SystemClockMillis();
m_packetsSent = 0;
Pause();
}
@@ -188,7 +189,7 @@ void CNullDirectSound::SwitchChannels(int iAudioStream, bool bAudioOnAllSpeakers
void CNullDirectSound::Update()
{
- long currentTime = CTimeUtils::GetTimeMS();
+ long currentTime = XbmcThreads::SystemClockMillis();
long deltaTime = (currentTime - m_lastUpdate);
if (m_paused)
diff --git a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp
index 9fccb06f76..666e84740e 100644
--- a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp
+++ b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp
@@ -18,6 +18,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "threads/SystemClock.h"
#include "system.h" // WIN32INCLUDES needed for the directsound stuff below
#include "Win32DirectSound.h"
#include "guilib/AudioContext.h"
@@ -212,7 +213,7 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, const CStdString&
m_bIsAllocated = true;
m_BufferOffset = 0;
m_CacheLen = 0;
- m_LastCacheCheck = CTimeUtils::GetTimeMS();
+ m_LastCacheCheck = XbmcThreads::SystemClockMillis();
return m_bIsAllocated;
}
@@ -379,7 +380,7 @@ void CWin32DirectSound::UpdateCacheStatus()
{
CSingleLock lock (m_critSection);
// TODO: Check to see if we may have cycled around since last time
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
if (time == m_LastCacheCheck)
return; // Don't recalc more frequently than once/ms (that is our max resolution anyway)
@@ -521,7 +522,7 @@ void CWin32DirectSound::WaitCompletion()
// The drain should complete in the time occupied by the cache
timeout = (DWORD)(1000 * GetDelay());
- timeout += CTimeUtils::GetTimeMS();
+ timeout += XbmcThreads::SystemClockMillis();
silence = (unsigned char*)calloc(1,m_dwChunkSize); // Initialize 'silence' to zero...
while(AddPackets(silence, m_dwChunkSize) == 0)
@@ -529,7 +530,7 @@ void CWin32DirectSound::WaitCompletion()
if(FAILED(m_pBuffer->GetStatus(&status)) || (status & DSBSTATUS_PLAYING) == 0)
break;
- if(timeout < CTimeUtils::GetTimeMS())
+ if(timeout < XbmcThreads::SystemClockMillis())
{
CLog::Log(LOGWARNING, __FUNCTION__ ": timeout adding silence to buffer");
break;
@@ -542,7 +543,7 @@ void CWin32DirectSound::WaitCompletion()
if(FAILED(m_pBuffer->GetStatus(&status)) || (status & DSBSTATUS_PLAYING) == 0)
break;
- if(timeout < CTimeUtils::GetTimeMS())
+ if(timeout < XbmcThreads::SystemClockMillis())
{
CLog::Log(LOGDEBUG, "CWin32DirectSound::WaitCompletion - timeout waiting for silence");
break;
diff --git a/xbmc/cores/AudioRenderers/Win32WASAPI.cpp b/xbmc/cores/AudioRenderers/Win32WASAPI.cpp
index 248cafef38..84ae4dd24b 100644
--- a/xbmc/cores/AudioRenderers/Win32WASAPI.cpp
+++ b/xbmc/cores/AudioRenderers/Win32WASAPI.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h" // WIN32INCLUDES needed for the WASAPI stuff below
#include <mmdeviceapi.h>
@@ -276,7 +277,7 @@ bool CWin32WASAPI::Initialize(IAudioCallback* pCallback, const CStdString& devic
m_bIsAllocated = true;
m_CacheLen = 0;
- m_LastCacheCheck = CTimeUtils::GetTimeMS();
+ m_LastCacheCheck = XbmcThreads::SystemClockMillis();
return m_bIsAllocated;
@@ -464,7 +465,7 @@ unsigned int CWin32WASAPI::AddPackets(const void* data, unsigned int len)
void CWin32WASAPI::UpdateCacheStatus()
{
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
if (time == m_LastCacheCheck)
return; // Don't recalc more frequently than once/ms (that is our max resolution anyway)
diff --git a/xbmc/cores/DummyVideoPlayer.cpp b/xbmc/cores/DummyVideoPlayer.cpp
index e6f9a10435..f0b4aebde6 100644
--- a/xbmc/cores/DummyVideoPlayer.cpp
+++ b/xbmc/cores/DummyVideoPlayer.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "DummyVideoPlayer.h"
#include "guilib/GUIFontManager.h"
@@ -75,14 +76,14 @@ bool CDummyVideoPlayer::IsPlaying() const
void CDummyVideoPlayer::Process()
{
m_clock = 0;
- m_lastTime = CTimeUtils::GetTimeMS();
+ m_lastTime = XbmcThreads::SystemClockMillis();
m_callback.OnPlayBackStarted();
while (!m_bStop)
{
if (!m_paused)
- m_clock += (CTimeUtils::GetTimeMS() - m_lastTime)*m_speed;
- m_lastTime = CTimeUtils::GetTimeMS();
+ m_clock += (XbmcThreads::SystemClockMillis() - m_lastTime)*m_speed;
+ m_lastTime = XbmcThreads::SystemClockMillis();
Sleep(0);
g_graphicsContext.Lock();
if (g_graphicsContext.IsFullScreenVideo())
diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp
index deb3f6a766..3d155c27ab 100644
--- a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp
+++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "signal.h"
#include "limits.h"
@@ -295,14 +296,14 @@ void CExternalPlayer::Process()
LockSetForegroundWindow(LSFW_UNLOCK);
#endif
- m_playbackStartTime = CTimeUtils::GetTimeMS();
+ m_playbackStartTime = XbmcThreads::SystemClockMillis();
BOOL ret = TRUE;
#if defined(_WIN32)
ret = ExecuteAppW32(strFName.c_str(),strFArgs.c_str());
#elif defined(_LINUX)
ret = ExecuteAppLinux(strFArgs.c_str());
#endif
- int64_t elapsedMillis = CTimeUtils::GetTimeMS() - m_playbackStartTime;
+ int64_t elapsedMillis = XbmcThreads::SystemClockMillis() - m_playbackStartTime;
if (ret && (m_islauncher || elapsedMillis < LAUNCHER_PROCESS_TIME))
{
@@ -554,7 +555,7 @@ void CExternalPlayer::SeekTime(__int64 iTime)
__int64 CExternalPlayer::GetTime() // in millis
{
- if ((CTimeUtils::GetTimeMS() - m_playbackStartTime) / 1000 > m_playCountMinTime)
+ if ((XbmcThreads::SystemClockMillis() - m_playbackStartTime) / 1000 > m_playCountMinTime)
{
m_time = m_totalTime * 1000;
}
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index ae478a8fb6..01b5894d63 100644
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
@@ -223,7 +224,7 @@ bool CDVDDemuxFFmpeg::Aborted()
if(!m_timeout)
return false;
- if(CTimeUtils::GetTimeMS() > m_timeout)
+ if(XbmcThreads::SystemClockMillis() > m_timeout)
return true;
return false;
@@ -271,7 +272,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput)
}
// try to abort after 30 seconds
- m_timeout = CTimeUtils::GetTimeMS() + 30000;
+ m_timeout = XbmcThreads::SystemClockMillis() + 30000;
if( m_pInput->IsStreamType(DVDSTREAM_TYPE_FFMPEG) )
{
@@ -648,7 +649,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
pkt.stream_index = MAX_STREAMS;
// timeout reads after 100ms
- m_timeout = CTimeUtils::GetTimeMS() + 20000;
+ m_timeout = XbmcThreads::SystemClockMillis() + 20000;
int result = 0;
try
{
diff --git a/xbmc/cores/dvdplayer/DVDFileInfo.cpp b/xbmc/cores/dvdplayer/DVDFileInfo.cpp
index a6d3829577..234263fe24 100644
--- a/xbmc/cores/dvdplayer/DVDFileInfo.cpp
+++ b/xbmc/cores/dvdplayer/DVDFileInfo.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "DVDFileInfo.h"
#include "FileItem.h"
#include "settings/AdvancedSettings.h"
@@ -73,7 +74,7 @@ bool CDVDFileInfo::GetFileDuration(const CStdString &path, int& duration)
bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, const CStdString &strTarget, CStreamDetails *pStreamDetails)
{
- int nTime = CTimeUtils::GetTimeMS();
+ int nTime = XbmcThreads::SystemClockMillis();
CDVDInputStream *pInputStream = CDVDFactoryInputStream::CreateInputStream(NULL, strPath, "");
if (!pInputStream)
{
@@ -249,7 +250,7 @@ bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, const CStdString &str
file.Close();
}
- int nTotalTime = CTimeUtils::GetTimeMS() - nTime;
+ int nTotalTime = XbmcThreads::SystemClockMillis() - nTime;
CLog::Log(LOGDEBUG,"%s - measured %d ms to extract thumb from file <%s> ", __FUNCTION__, nTotalTime, strPath.c_str());
return bOk;
}
diff --git a/xbmc/cores/dvdplayer/DVDMessage.cpp b/xbmc/cores/dvdplayer/DVDMessage.cpp
index d8a7c9ea12..c9393684dd 100644
--- a/xbmc/cores/dvdplayer/DVDMessage.cpp
+++ b/xbmc/cores/dvdplayer/DVDMessage.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "DVDMessage.h"
#include "DVDDemuxers/DVDDemuxUtils.h"
#include "DVDStreamInfo.h"
@@ -46,12 +47,12 @@ void CDVDMsgGeneralSynchronize::Wait(volatile bool *abort, DWORD source)
AtomicIncrement(&m_objects);
- DWORD timeout = CTimeUtils::GetTimeMS() + m_timeout;
+ DWORD timeout = XbmcThreads::SystemClockMillis() + m_timeout;
if (abort)
- while( m_objects < GetNrOfReferences() && timeout > CTimeUtils::GetTimeMS() && !(*abort)) Sleep(1);
+ while( m_objects < GetNrOfReferences() && timeout > XbmcThreads::SystemClockMillis() && !(*abort)) Sleep(1);
else
- while( m_objects < GetNrOfReferences() && timeout > CTimeUtils::GetTimeMS() ) Sleep(1);
+ while( m_objects < GetNrOfReferences() && timeout > XbmcThreads::SystemClockMillis() ) Sleep(1);
}
/**
diff --git a/xbmc/cores/dvdplayer/DVDMessageTracker.cpp b/xbmc/cores/dvdplayer/DVDMessageTracker.cpp
index 0f03b38f08..2cc4458975 100644
--- a/xbmc/cores/dvdplayer/DVDMessageTracker.cpp
+++ b/xbmc/cores/dvdplayer/DVDMessageTracker.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "DVDMessageTracker.h"
#include "DVDMessage.h"
#include "threads/SingleLock.h"
@@ -98,7 +99,7 @@ void CDVDMessageTracker::Process()
while (!m_bStop && iter != m_messageList.end())
{
CDVDMessageTrackerItem* pItem = *iter;
- if ((CTimeUtils::GetTimeMS() - pItem->m_time_created) > 60000)
+ if ((XbmcThreads::SystemClockMillis() - pItem->m_time_created) > 60000)
{
if (!pItem->m_debug_logged)
{
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
index fb08af2ec7..c3694515c6 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "DVDPlayer.h"
@@ -1088,7 +1089,7 @@ void CDVDPlayer::Process()
{
if (m_dvd.iDVDStillTime > 0)
{
- if (CTimeUtils::GetTimeMS() >= (m_dvd.iDVDStillStartTime + m_dvd.iDVDStillTime))
+ if (XbmcThreads::SystemClockMillis() >= (m_dvd.iDVDStillStartTime + m_dvd.iDVDStillTime))
{
m_dvd.iDVDStillTime = 0;
m_dvd.iDVDStillStartTime = 0;
@@ -3070,7 +3071,7 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage)
else
m_dvd.iDVDStillTime = 0;
- m_dvd.iDVDStillStartTime = CTimeUtils::GetTimeMS();
+ m_dvd.iDVDStillStartTime = XbmcThreads::SystemClockMillis();
/* adjust for the output delay in the video queue */
DWORD time = 0;
@@ -3660,7 +3661,7 @@ void CDVDPlayer::UpdatePlayState(double timeout)
{
if(m_dvd.state == DVDSTATE_STILL)
{
- m_State.time = CTimeUtils::GetTimeMS() - m_dvd.iDVDStillStartTime;
+ m_State.time = XbmcThreads::SystemClockMillis() - m_dvd.iDVDStillStartTime;
m_State.time_total = m_dvd.iDVDStillTime;
}
diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp
index 6f3fc9f1a0..fa1b9a9068 100644
--- a/xbmc/cores/paplayer/PAPlayer.cpp
+++ b/xbmc/cores/paplayer/PAPlayer.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "PAPlayer.h"
#include "CodecFactory.h"
#include "GUIInfoManager.h"
@@ -494,13 +495,13 @@ void PAPlayer::ToFFRW(int iSpeed)
void PAPlayer::UpdateCacheLevel()
{
//check cachelevel every .5 seconds
- if (m_LastCacheLevelCheck + 500 < CTimeUtils::GetTimeMS())
+ if (m_LastCacheLevelCheck + 500 < XbmcThreads::SystemClockMillis())
{
ICodec* codec = m_decoder[m_currentDecoder].GetCodec();
if (codec)
{
m_CacheLevel = codec->GetCacheLevel();
- m_LastCacheLevelCheck = CTimeUtils::GetTimeMS();
+ m_LastCacheLevelCheck = XbmcThreads::SystemClockMillis();
//CLog::Log(LOGDEBUG,"Cachelevel: %i%%", m_CacheLevel);
}
}
@@ -887,9 +888,9 @@ void PAPlayer::HandleSeeking()
{
if (m_SeekTime != -1)
{
- DWORD time = CTimeUtils::GetTimeMS();
+ DWORD time = XbmcThreads::SystemClockMillis();
m_timeOffset = m_decoder[m_currentDecoder].Seek(m_SeekTime);
- CLog::Log(LOGDEBUG, "Seek to time %f took %i ms", 0.001f * m_SeekTime, CTimeUtils::GetTimeMS() - time);
+ CLog::Log(LOGDEBUG, "Seek to time %f took %i ms", 0.001f * m_SeekTime, XbmcThreads::SystemClockMillis() - time);
FlushStreams();
m_SeekTime = -1;
}
diff --git a/xbmc/dialogs/GUIDialogCache.cpp b/xbmc/dialogs/GUIDialogCache.cpp
index da3ab63f48..8e39e78f2f 100644
--- a/xbmc/dialogs/GUIDialogCache.cpp
+++ b/xbmc/dialogs/GUIDialogCache.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "GUIDialogCache.h"
#include "Application.h"
#include "guilib/GUIWindowManager.h"
@@ -43,7 +44,7 @@ CGUIDialogCache::CGUIDialogCache(DWORD dwDelay, const CStdString& strHeader, con
if(dwDelay == 0)
OpenDialog();
else
- m_dwTimeStamp = CTimeUtils::GetTimeMS() + dwDelay;
+ m_dwTimeStamp = XbmcThreads::SystemClockMillis() + dwDelay;
Create(true);
}
@@ -132,7 +133,7 @@ void CGUIDialogCache::Process()
{
bSentCancel = true;
}
- else if( !m_pDlg->IsDialogRunning() && CTimeUtils::GetTimeMS() > m_dwTimeStamp
+ else if( !m_pDlg->IsDialogRunning() && XbmcThreads::SystemClockMillis() > m_dwTimeStamp
&& !g_windowManager.IsWindowActive(WINDOW_DIALOG_YES_NO) )
OpenDialog();
}
diff --git a/xbmc/filesystem/CacheCircular.cpp b/xbmc/filesystem/CacheCircular.cpp
index 8e58466107..53565cbcbd 100644
--- a/xbmc/filesystem/CacheCircular.cpp
+++ b/xbmc/filesystem/CacheCircular.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "utils/log.h"
#include "threads/SingleLock.h"
@@ -177,8 +178,8 @@ int64_t CCacheCircular::WaitForData(unsigned int minumum, unsigned int millis)
if(minumum > m_size - m_size_back)
minumum = m_size - m_size_back;
- unsigned int time = CTimeUtils::GetTimeMS() + millis;
- while (!IsEndOfInput() && avail < minumum && CTimeUtils::GetTimeMS() < time )
+ unsigned int time = XbmcThreads::SystemClockMillis() + millis;
+ while (!IsEndOfInput() && avail < minumum && XbmcThreads::SystemClockMillis() < time )
{
lock.Leave();
m_written.WaitMSec(50); // may miss the deadline. shouldn't be a problem.
diff --git a/xbmc/filesystem/CacheMemBuffer.cpp b/xbmc/filesystem/CacheMemBuffer.cpp
index 59db6a067f..f05c5fb6a2 100644
--- a/xbmc/filesystem/CacheMemBuffer.cpp
+++ b/xbmc/filesystem/CacheMemBuffer.cpp
@@ -20,6 +20,7 @@
*/
#ifdef _LINUX
+#include "threads/SystemClock.h"
#include "linux/PlatformDefs.h"
#endif
#include "settings/AdvancedSettings.h"
@@ -136,8 +137,8 @@ int64_t CacheMemBuffer::WaitForData(unsigned int iMinAvail, unsigned int millis)
if (millis == 0 || IsEndOfInput())
return m_buffer.getMaxReadSize();
- unsigned int time = CTimeUtils::GetTimeMS() + millis;
- while (!IsEndOfInput() && (unsigned int) m_buffer.getMaxReadSize() < iMinAvail && CTimeUtils::GetTimeMS() < time )
+ unsigned int time = XbmcThreads::SystemClockMillis() + millis;
+ while (!IsEndOfInput() && (unsigned int) m_buffer.getMaxReadSize() < iMinAvail && XbmcThreads::SystemClockMillis() < time )
m_written.WaitMSec(50); // may miss the deadline. shouldn't be a problem.
return m_buffer.getMaxReadSize();
diff --git a/xbmc/filesystem/CacheStrategy.cpp b/xbmc/filesystem/CacheStrategy.cpp
index 4afdd7c8b2..57bd0287e3 100644
--- a/xbmc/filesystem/CacheStrategy.cpp
+++ b/xbmc/filesystem/CacheStrategy.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "CacheStrategy.h"
#ifdef _LINUX
#include "PlatformInclude.h"
@@ -184,9 +185,9 @@ int64_t CSimpleFileCache::WaitForData(unsigned int iMinAvail, unsigned int iMill
if( iMillis == 0 || IsEndOfInput() )
return GetAvailableRead();
- unsigned int timeout = CTimeUtils::GetTimeMS() + iMillis;
+ unsigned int timeout = XbmcThreads::SystemClockMillis() + iMillis;
unsigned int time;
- while ( !IsEndOfInput() && (time = CTimeUtils::GetTimeMS()) < timeout )
+ while ( !IsEndOfInput() && (time = XbmcThreads::SystemClockMillis()) < timeout )
{
int64_t iAvail = GetAvailableRead();
if (iAvail >= iMinAvail)
diff --git a/xbmc/filesystem/DllLibCurl.cpp b/xbmc/filesystem/DllLibCurl.cpp
index 063810ff19..eca4c61bfe 100644
--- a/xbmc/filesystem/DllLibCurl.cpp
+++ b/xbmc/filesystem/DllLibCurl.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "DllLibCurl.h"
#include "threads/SingleLock.h"
@@ -76,7 +77,7 @@ void DllLibCurlGlobal::Unload()
/* CheckIdle will clear this one up */
if(g_curlReferences == 1)
- g_curlTimeout = CTimeUtils::GetTimeMS();
+ g_curlTimeout = XbmcThreads::SystemClockMillis();
}
void DllLibCurlGlobal::CheckIdle()
@@ -92,7 +93,7 @@ void DllLibCurlGlobal::CheckIdle()
VEC_CURLSESSIONS::iterator it = m_sessions.begin();
while(it != m_sessions.end())
{
- if( !it->m_busy && it->m_idletimestamp + idletime < CTimeUtils::GetTimeMS())
+ if( !it->m_busy && it->m_idletimestamp + idletime < XbmcThreads::SystemClockMillis())
{
CLog::Log(LOGINFO, "%s - Closing session to %s://%s (easy=%p, multi=%p)\n", __FUNCTION__, it->m_protocol.c_str(), it->m_hostname.c_str(), (void*)it->m_easy, (void*)it->m_multi);
@@ -112,7 +113,7 @@ void DllLibCurlGlobal::CheckIdle()
}
/* check if we should unload the dll */
- if(g_curlReferences == 1 && CTimeUtils::GetTimeMS() > g_curlTimeout + idletime)
+ if(g_curlReferences == 1 && XbmcThreads::SystemClockMillis() > g_curlTimeout + idletime)
Unload();
}
@@ -210,7 +211,7 @@ void DllLibCurlGlobal::easy_release(CURL_HANDLE** easy_handle, CURLM** multi_han
/* will reset verbose too so it won't print that it closed connections on cleanup*/
easy_reset(easy);
it->m_busy = false;
- it->m_idletimestamp = CTimeUtils::GetTimeMS();
+ it->m_idletimestamp = XbmcThreads::SystemClockMillis();
return;
}
}
diff --git a/xbmc/filesystem/FileCache.cpp b/xbmc/filesystem/FileCache.cpp
index e9ac2429fa..edea216a61 100644
--- a/xbmc/filesystem/FileCache.cpp
+++ b/xbmc/filesystem/FileCache.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "utils/AutoPtrHandle.h"
#include "FileCache.h"
#include "threads/Thread.h"
@@ -41,20 +42,20 @@ class CWriteRate
public:
CWriteRate()
{
- m_stamp = CTimeUtils::GetTimeMS();
+ m_stamp = XbmcThreads::SystemClockMillis();
m_pos = 0;
m_pause = 0;
}
void Reset(int64_t pos)
{
- m_stamp = CTimeUtils::GetTimeMS();
+ m_stamp = XbmcThreads::SystemClockMillis();
m_pos = pos;
}
unsigned Rate(int64_t pos, unsigned int time_bias = 0)
{
- const unsigned ts = CTimeUtils::GetTimeMS() + time_bias;
+ const unsigned ts = XbmcThreads::SystemClockMillis() + time_bias;
if(ts == m_stamp)
return 0;
return (unsigned)(1000 * (pos - m_pos) / (ts - m_stamp));
@@ -62,12 +63,12 @@ public:
void Pause()
{
- m_pause = CTimeUtils::GetTimeMS();
+ m_pause = XbmcThreads::SystemClockMillis();
}
void Resume()
{
- m_stamp += CTimeUtils::GetTimeMS() - m_pause;
+ m_stamp += XbmcThreads::SystemClockMillis() - m_pause;
m_pause = 0;
}
diff --git a/xbmc/filesystem/FileSFTP.cpp b/xbmc/filesystem/FileSFTP.cpp
index 35934fce62..7db3e8f8b9 100644
--- a/xbmc/filesystem/FileSFTP.cpp
+++ b/xbmc/filesystem/FileSFTP.cpp
@@ -20,6 +20,7 @@
*/
+#include "threads/SystemClock.h"
#include "FileSFTP.h"
#ifdef HAS_FILESYSTEM_SFTP
#include "threads/SingleLock.h"
@@ -56,7 +57,7 @@ CSFTPSession::CSFTPSession(const CStdString &host, unsigned int port, const CStd
if (!Connect(host, port, username, password))
Disconnect();
- m_LastActive = CTimeUtils::GetTimeMS();
+ m_LastActive = XbmcThreads::SystemClockMillis();
}
CSFTPSession::~CSFTPSession()
@@ -70,7 +71,7 @@ sftp_file CSFTPSession::CreateFileHande(const CStdString &file)
if (m_connected)
{
CSingleLock lock(m_critSect);
- m_LastActive = CTimeUtils::GetTimeMS();
+ m_LastActive = XbmcThreads::SystemClockMillis();
sftp_file handle = sftp_open(m_sftp_session, CorrectPath(file).c_str(), O_RDONLY, 0);
if (handle)
{
@@ -100,7 +101,7 @@ bool CSFTPSession::GetDirectory(const CStdString &base, const CStdString &folder
{
CSingleLock lock(m_critSect);
- m_LastActive = CTimeUtils::GetTimeMS();
+ m_LastActive = XbmcThreads::SystemClockMillis();
dir = sftp_opendir(m_sftp_session, CorrectPath(folder).c_str());
}
@@ -206,7 +207,7 @@ int CSFTPSession::Stat(const char *path, struct __stat64* buffer)
CSingleLock lock(m_critSect);
if(m_connected)
{
- m_LastActive = CTimeUtils::GetTimeMS();
+ m_LastActive = XbmcThreads::SystemClockMillis();
sftp_attributes attributes = sftp_stat(m_sftp_session, CorrectPath(path).c_str());
if (attributes)
@@ -235,27 +236,27 @@ int CSFTPSession::Stat(const char *path, struct __stat64* buffer)
int CSFTPSession::Seek(sftp_file handle, uint64_t position)
{
CSingleLock lock(m_critSect);
- m_LastActive = CTimeUtils::GetTimeMS();
+ m_LastActive = XbmcThreads::SystemClockMillis();
return sftp_seek64(handle, position);
}
int CSFTPSession::Read(sftp_file handle, void *buffer, size_t length)
{
CSingleLock lock(m_critSect);
- m_LastActive = CTimeUtils::GetTimeMS();
+ m_LastActive = XbmcThreads::SystemClockMillis();
return sftp_read(handle, buffer, length);
}
int64_t CSFTPSession::GetPosition(sftp_file handle)
{
CSingleLock lock(m_critSect);
- m_LastActive = CTimeUtils::GetTimeMS();
+ m_LastActive = XbmcThreads::SystemClockMillis();
return sftp_tell64(handle);
}
bool CSFTPSession::IsIdle()
{
- return (CTimeUtils::GetTimeMS() - m_LastActive) > 90000;
+ return (XbmcThreads::SystemClockMillis() - m_LastActive) > 90000;
}
bool CSFTPSession::VerifyKnownHost(ssh_session session)
diff --git a/xbmc/filesystem/FileShoutcast.cpp b/xbmc/filesystem/FileShoutcast.cpp
index 5f6148fa98..a88328d815 100644
--- a/xbmc/filesystem/FileShoutcast.cpp
+++ b/xbmc/filesystem/FileShoutcast.cpp
@@ -24,6 +24,7 @@
//
//////////////////////////////////////////////////////////////////////
+#include "threads/SystemClock.h"
#include "system.h"
#include "Application.h"
#include "FileShoutcast.h"
@@ -39,7 +40,7 @@ using namespace MUSIC_INFO;
CFileShoutcast::CFileShoutcast()
{
- m_lastTime = CTimeUtils::GetTimeMS();
+ m_lastTime = XbmcThreads::SystemClockMillis();
m_discarded = 0;
m_currint = 0;
m_buffer = NULL;
@@ -95,9 +96,9 @@ unsigned int CFileShoutcast::Read(void* lpBuf, int64_t uiBufSize)
m_discarded += header*16+1;
m_currint = 0;
}
- if (CTimeUtils::GetTimeMS() - m_lastTime > 500)
+ if (XbmcThreads::SystemClockMillis() - m_lastTime > 500)
{
- m_lastTime = CTimeUtils::GetTimeMS();
+ m_lastTime = XbmcThreads::SystemClockMillis();
g_infoManager.SetCurrentSongTag(m_tag);
}
diff --git a/xbmc/filesystem/HDHomeRun.cpp b/xbmc/filesystem/HDHomeRun.cpp
index 486e75df82..bf7b801bcb 100644
--- a/xbmc/filesystem/HDHomeRun.cpp
+++ b/xbmc/filesystem/HDHomeRun.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "URL.h"
#include "FileItem.h"
@@ -244,7 +245,7 @@ unsigned int CFileHomeRun::Read(void* lpBuf, int64_t uiBufSize)
// neither of the players can be forced to
// continue even if read return 0 as can happen
// on live streams.
- unsigned int timestamp = CTimeUtils::GetTimeMS() + 5000;
+ unsigned int timestamp = XbmcThreads::SystemClockMillis() + 5000;
while(1)
{
datasize = (size_t) uiBufSize;
@@ -255,7 +256,7 @@ unsigned int CFileHomeRun::Read(void* lpBuf, int64_t uiBufSize)
return (unsigned int)datasize;
}
- if(CTimeUtils::GetTimeMS() > timestamp)
+ if(XbmcThreads::SystemClockMillis() > timestamp)
return 0;
Sleep(64);
diff --git a/xbmc/filesystem/HTSPDirectory.cpp b/xbmc/filesystem/HTSPDirectory.cpp
index dafb8e67fc..a28a41643a 100644
--- a/xbmc/filesystem/HTSPDirectory.cpp
+++ b/xbmc/filesystem/HTSPDirectory.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "HTSPDirectory.h"
#include "URL.h"
#include "FileItem.h"
@@ -58,7 +59,7 @@ struct STimedOut
{
STimedOut(DWORD idle) : m_idle(idle)
{
- m_time = CTimeUtils::GetTimeMS();
+ m_time = XbmcThreads::SystemClockMillis();
}
bool operator()(SSession& data)
{
@@ -131,7 +132,7 @@ void CHTSPDirectorySession::Release(CHTSPDirectorySession* &session)
if(it->session == session)
{
it->refs--;
- it->last = CTimeUtils::GetTimeMS();
+ it->last = XbmcThreads::SystemClockMillis();
return;
}
}
diff --git a/xbmc/filesystem/MultiPathDirectory.cpp b/xbmc/filesystem/MultiPathDirectory.cpp
index 726c8b0684..0ca7789fe2 100644
--- a/xbmc/filesystem/MultiPathDirectory.cpp
+++ b/xbmc/filesystem/MultiPathDirectory.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "MultiPathDirectory.h"
#include "Directory.h"
#include "Util.h"
@@ -55,14 +56,14 @@ bool CMultiPathDirectory::GetDirectory(const CStdString& strPath, CFileItemList
if (!GetPaths(strPath, vecPaths))
return false;
- unsigned int progressTime = CTimeUtils::GetTimeMS() + 3000L; // 3 seconds before showing progress bar
+ unsigned int progressTime = XbmcThreads::SystemClockMillis() + 3000L; // 3 seconds before showing progress bar
CGUIDialogProgress* dlgProgress = NULL;
unsigned int iFailures = 0;
for (unsigned int i = 0; i < vecPaths.size(); ++i)
{
// show the progress dialog if we have passed our time limit
- if (CTimeUtils::GetTimeMS() > progressTime && !dlgProgress)
+ if (XbmcThreads::SystemClockMillis() > progressTime && !dlgProgress)
{
dlgProgress = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (dlgProgress)
@@ -246,7 +247,7 @@ CStdString CMultiPathDirectory::ConstructMultiPath(const vector<CStdString> &vec
void CMultiPathDirectory::MergeItems(CFileItemList &items)
{
CLog::Log(LOGDEBUG, "CMultiPathDirectory::MergeItems, items = %i", (int)items.Size());
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
if (items.Size() == 0)
return;
// sort items by label
@@ -303,7 +304,7 @@ void CMultiPathDirectory::MergeItems(CFileItemList &items)
CLog::Log(LOGDEBUG,
"CMultiPathDirectory::MergeItems, items = %i, took %d ms",
- items.Size(), CTimeUtils::GetTimeMS() - time);
+ items.Size(), XbmcThreads::SystemClockMillis() - time);
}
bool CMultiPathDirectory::SupportsFileOperations(const CStdString &strPath)
diff --git a/xbmc/filesystem/MusicSearchDirectory.cpp b/xbmc/filesystem/MusicSearchDirectory.cpp
index 819ec6cb6f..d9e522d43d 100644
--- a/xbmc/filesystem/MusicSearchDirectory.cpp
+++ b/xbmc/filesystem/MusicSearchDirectory.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "MusicSearchDirectory.h"
#include "music/MusicDatabase.h"
#include "URL.h"
@@ -49,13 +50,13 @@ bool CMusicSearchDirectory::GetDirectory(const CStdString& strPath, CFileItemLis
// and retrieve the search details
items.m_strPath = strPath;
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
CMusicDatabase db;
db.Open();
db.Search(search, items);
db.Close();
CLog::Log(LOGDEBUG, "%s (%s) took %u ms",
- __FUNCTION__, strPath.c_str(), CTimeUtils::GetTimeMS() - time);
+ __FUNCTION__, strPath.c_str(), XbmcThreads::SystemClockMillis() - time);
items.SetLabel(g_localizeStrings.Get(137)); // Search
return true;
}
diff --git a/xbmc/filesystem/MythFile.cpp b/xbmc/filesystem/MythFile.cpp
index 56b66b2881..5230ab0506 100644
--- a/xbmc/filesystem/MythFile.cpp
+++ b/xbmc/filesystem/MythFile.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "MythFile.h"
#include "XBDateTime.h"
#include "FileItem.h"
@@ -255,7 +256,7 @@ bool CMythFile::SetupLiveTV(const CURL& url)
}
m_program = m_dll->recorder_get_cur_proginfo(m_recorder);
- m_timestamp = CTimeUtils::GetTimeMS();
+ m_timestamp = XbmcThreads::SystemClockMillis();
if(m_program)
m_starttime = m_dll->proginfo_rec_start(m_program);
@@ -546,9 +547,9 @@ bool CMythFile::UpdateItem(CFileItem& item)
int CMythFile::GetTotalTime()
{
- if(m_recorder && m_timestamp + 5000 < CTimeUtils::GetTimeMS())
+ if(m_recorder && m_timestamp + 5000 < XbmcThreads::SystemClockMillis())
{
- m_timestamp = CTimeUtils::GetTimeMS();
+ m_timestamp = XbmcThreads::SystemClockMillis();
if(m_program)
m_dll->ref_release(m_program);
m_program = m_dll->recorder_get_cur_proginfo(m_recorder);
@@ -718,4 +719,4 @@ int CMythFile::IoControl(EIoControl request, void* param)
return 1;
}
return -1;
-} \ No newline at end of file
+}
diff --git a/xbmc/filesystem/MythSession.cpp b/xbmc/filesystem/MythSession.cpp
index 36c32fdd47..502bd834cb 100644
--- a/xbmc/filesystem/MythSession.cpp
+++ b/xbmc/filesystem/MythSession.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "DllLibCMyth.h"
#include "MythSession.h"
#include "video/VideoInfoTag.h"
@@ -59,7 +60,7 @@ void CMythSession::CheckIdle()
for (it = m_sessions.begin(); it != m_sessions.end(); )
{
CMythSession* session = *it;
- if (session->m_timestamp + (MYTH_IDLE_TIMEOUT * 1000) < CTimeUtils::GetTimeMS())
+ if (session->m_timestamp + (MYTH_IDLE_TIMEOUT * 1000) < XbmcThreads::SystemClockMillis())
{
CLog::Log(LOGINFO, "%s - closing idle connection to MythTV backend: %s", __FUNCTION__, session->m_hostname.c_str());
delete session;
@@ -97,7 +98,7 @@ void CMythSession::ReleaseSession(CMythSession* session)
{
CLog::Log(LOGDEBUG, "%s - Releasing MythTV session: %p", __FUNCTION__, session);
session->SetListener(NULL);
- session->m_timestamp = CTimeUtils::GetTimeMS();
+ session->m_timestamp = XbmcThreads::SystemClockMillis();
CSingleLock lock(m_section_session);
m_sessions.push_back(session);
}
@@ -367,7 +368,7 @@ CMythSession::CMythSession(const CURL& url)
m_username = url.GetUserName() == "" ? MYTH_DEFAULT_USERNAME : url.GetUserName();
m_password = url.GetPassWord() == "" ? MYTH_DEFAULT_PASSWORD : url.GetPassWord();
m_port = url.HasPort() ? url.GetPort() : MYTH_DEFAULT_PORT;
- m_timestamp = CTimeUtils::GetTimeMS();
+ m_timestamp = XbmcThreads::SystemClockMillis();
m_dll = new DllLibCMyth;
m_dll->Load();
if (m_dll->IsLoaded())
diff --git a/xbmc/filesystem/PluginDirectory.cpp b/xbmc/filesystem/PluginDirectory.cpp
index de6ab16f04..1e259f0ce3 100644
--- a/xbmc/filesystem/PluginDirectory.cpp
+++ b/xbmc/filesystem/PluginDirectory.cpp
@@ -20,6 +20,7 @@
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "PluginDirectory.h"
#include "utils/URIUtils.h"
@@ -446,7 +447,7 @@ bool CPluginDirectory::WaitOnScriptResult(const CStdString &scriptPath, const CS
const unsigned int timeBeforeProgressBar = 1500;
const unsigned int timeToKillScript = 1000;
- unsigned int startTime = CTimeUtils::GetTimeMS();
+ unsigned int startTime = XbmcThreads::SystemClockMillis();
CGUIDialogProgress *progressBar = NULL;
CLog::Log(LOGDEBUG, "%s - waiting on the %s plugin...", __FUNCTION__, scriptName.c_str());
@@ -475,14 +476,14 @@ bool CPluginDirectory::WaitOnScriptResult(const CStdString &scriptPath, const CS
}
// check whether we should pop up the progress dialog
- if (!progressBar && CTimeUtils::GetTimeMS() - startTime > timeBeforeProgressBar)
+ if (!progressBar && XbmcThreads::SystemClockMillis() - startTime > timeBeforeProgressBar)
{ // loading takes more then 1.5 secs, show a progress dialog
progressBar = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
// if script has shown progressbar don't override it
if (progressBar && progressBar->IsActive())
{
- startTime = CTimeUtils::GetTimeMS();
+ startTime = XbmcThreads::SystemClockMillis();
progressBar = NULL;
}
@@ -518,9 +519,9 @@ bool CPluginDirectory::WaitOnScriptResult(const CStdString &scriptPath, const CS
if (!m_cancelled)
{
m_cancelled = true;
- startTime = CTimeUtils::GetTimeMS();
+ startTime = XbmcThreads::SystemClockMillis();
}
- if (m_cancelled && CTimeUtils::GetTimeMS() - startTime > timeToKillScript)
+ if (m_cancelled && XbmcThreads::SystemClockMillis() - startTime > timeToKillScript)
{ // cancel our script
#ifdef HAS_PYTHON
int id = g_pythonParser.getScriptId(scriptPath.c_str());
diff --git a/xbmc/filesystem/SAPDirectory.cpp b/xbmc/filesystem/SAPDirectory.cpp
index 15ec6d8296..3912c14566 100644
--- a/xbmc/filesystem/SAPDirectory.cpp
+++ b/xbmc/filesystem/SAPDirectory.cpp
@@ -17,6 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "threads/SystemClock.h"
#include "system.h" // WIN32INCLUDES - not sure why this is needed
#include "GUIUserMessages.h"
#include "guilib/GUIWindowManager.h"
@@ -340,7 +341,7 @@ bool CSAPSessions::ParseAnnounce(char* data, int len)
}
// should be improved in the case of sdp
- it->timeout = CTimeUtils::GetTimeMS() + 60*60*1000;
+ it->timeout = XbmcThreads::SystemClockMillis() + 60*60*1000;
return true;
}
}
@@ -367,7 +368,7 @@ bool CSAPSessions::ParseAnnounce(char* data, int len)
session.payload_type = header.payload_type;
session.payload_origin = desc.origin;
session.payload.assign(data, len);
- session.timeout = CTimeUtils::GetTimeMS() + 60*60*1000;
+ session.timeout = XbmcThreads::SystemClockMillis() + 60*60*1000;
m_sessions.push_back(session);
CGUIMessage message(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_PATH);
diff --git a/xbmc/input/linux/LIRC.cpp b/xbmc/input/linux/LIRC.cpp
index dcbdf94f1e..4a77310d82 100644
--- a/xbmc/input/linux/LIRC.cpp
+++ b/xbmc/input/linux/LIRC.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -124,7 +125,7 @@ void CRemoteControl::setDeviceName(const CStdString& value)
void CRemoteControl::Initialize()
{
struct sockaddr_un addr;
- int now = CTimeUtils::GetTimeMS();
+ int now = XbmcThreads::SystemClockMillis();
if (!m_used || now < m_lastInitAttempt + m_initRetryPeriod)
return;
@@ -241,7 +242,7 @@ void CRemoteControl::Update()
if (!CheckDevice())
return;
- uint32_t now = CTimeUtils::GetTimeMS();
+ uint32_t now = XbmcThreads::SystemClockMillis();
// Read a line from the socket
while (fgets(m_buf, sizeof(m_buf), m_file) != NULL)
diff --git a/xbmc/input/windows/IRServerSuite.cpp b/xbmc/input/windows/IRServerSuite.cpp
index 311052bc9e..3ccda8867d 100644
--- a/xbmc/input/windows/IRServerSuite.cpp
+++ b/xbmc/input/windows/IRServerSuite.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "IRServerSuite.h"
#include "IrssMessage.h"
#include "input/ButtonTranslator.h"
@@ -84,14 +85,14 @@ void CRemoteControl::Initialize()
void CRemoteControl::Process()
{
DWORD iMsRetryDelay = 5000;
- DWORD time = CTimeUtils::GetTimeMS() - iMsRetryDelay;
+ DWORD time = XbmcThreads::SystemClockMillis() - iMsRetryDelay;
// try to connect 60 times @ a 5 second interval (5 minutes)
// multiple tries because irss service might be up and running a little later then xbmc on boot.
while (!m_bStop && m_iAttempt <= 60)
{
- if (CTimeUtils::GetTimeMS() - time >= iMsRetryDelay)
+ if (XbmcThreads::SystemClockMillis() - time >= iMsRetryDelay)
{
- time = CTimeUtils::GetTimeMS();
+ time = XbmcThreads::SystemClockMillis();
if (Connect())
break;
diff --git a/xbmc/interfaces/http-api/XBMChttp.cpp b/xbmc/interfaces/http-api/XBMChttp.cpp
index 99a68d22e4..01d8cabd9b 100644
--- a/xbmc/interfaces/http-api/XBMChttp.cpp
+++ b/xbmc/interfaces/http-api/XBMChttp.cpp
@@ -9,6 +9,7 @@
/********************************* Includes ***********************************/
+#include "threads/SystemClock.h"
#include "Application.h"
#include "XBMCConfiguration.h"
#include "XBMChttp.h"
@@ -2062,9 +2063,9 @@ CStdString CXbmcHttp::GetCloseTag()
CKey CXbmcHttp::GetKey()
{
if (repeatKeyRate!=0)
- if (CTimeUtils::GetTimeMS() >= MarkTime + repeatKeyRate)
+ if (XbmcThreads::SystemClockMillis() >= MarkTime + repeatKeyRate)
{
- MarkTime=CTimeUtils::GetTimeMS();
+ MarkTime=XbmcThreads::SystemClockMillis();
key=lastKey;
}
return key;
diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp
index 4995b94403..43742540b1 100644
--- a/xbmc/interfaces/python/XBPython.cpp
+++ b/xbmc/interfaces/python/XBPython.cpp
@@ -39,6 +39,7 @@
#include "utils/TimeUtils.h"
#include "Util.h"
+#include "threads/SystemClock.h"
#include "addons/Addon.h"
extern "C" HMODULE __stdcall dllLoadLibraryA(LPCSTR file);
@@ -405,7 +406,7 @@ void XBPython::FinalizeScript()
m_iDllScriptCounter--;
else
CLog::Log(LOGERROR, "Python script counter attempted to become negative");
- m_endtime = CTimeUtils::GetTimeMS();
+ m_endtime = XbmcThreads::SystemClockMillis();
}
void XBPython::Finalize()
{
@@ -489,7 +490,7 @@ void XBPython::Process()
else ++it;
}
- if(m_iDllScriptCounter == 0 && m_endtime + 10000 < CTimeUtils::GetTimeMS())
+ if(m_iDllScriptCounter == 0 && m_endtime + 10000 < XbmcThreads::SystemClockMillis())
Finalize();
}
}
diff --git a/xbmc/linux/XLCDproc.cpp b/xbmc/linux/XLCDproc.cpp
index 8a21d0be1c..d83a8d7c98 100644
--- a/xbmc/linux/XLCDproc.cpp
+++ b/xbmc/linux/XLCDproc.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "PlatformInclude.h"
#include "XLCDproc.h"
#include "../utils/log.h"
@@ -56,7 +57,7 @@ void XLCDproc::Initialize()
return ;//nothing to do
// don't try to initialize too often
- int now = CTimeUtils::GetTimeMS();
+ int now = XbmcThreads::SystemClockMillis();
if (now < m_lastInitAttempt + m_initRetryInterval)
return;
m_lastInitAttempt = now;
diff --git a/xbmc/music/LastFmManager.cpp b/xbmc/music/LastFmManager.cpp
index 8e19171df1..080ef2c298 100644
--- a/xbmc/music/LastFmManager.cpp
+++ b/xbmc/music/LastFmManager.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "LastFmManager.h"
#include "Album.h"
#include "Artist.h"
@@ -206,7 +207,7 @@ void CLastFmManager::CloseProgressDialog()
bool CLastFmManager::ChangeStation(const CURL& stationUrl)
{
- unsigned int start = CTimeUtils::GetTimeMS();
+ unsigned int start = XbmcThreads::SystemClockMillis();
InitProgressDialog(stationUrl.Get());
@@ -258,7 +259,7 @@ bool CLastFmManager::ChangeStation(const CURL& stationUrl)
g_application.m_strPlayListFile = stationUrl.Get(); //needed to highlight the playing item
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC);
g_playlistPlayer.Play(0);
- CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start));
+ CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(XbmcThreads::SystemClockMillis() - start));
CloseProgressDialog();
return true;
}
@@ -268,7 +269,7 @@ bool CLastFmManager::ChangeStation(const CURL& stationUrl)
bool CLastFmManager::RequestRadioTracks()
{
- unsigned int start = CTimeUtils::GetTimeMS();
+ unsigned int start = XbmcThreads::SystemClockMillis();
CStdString url;
CStdString html;
url.Format("http://" + m_RadioBaseUrl + m_RadioBasePath + "/xspf.php?sk=%s&discovery=0&desktop=", m_RadioSession);
@@ -408,13 +409,13 @@ bool CLastFmManager::RequestRadioTracks()
//end parse
CSingleLock lock(m_lockCache);
int iNrCachedTracks = m_RadioTrackQueue->size();
- CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start));
+ CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(XbmcThreads::SystemClockMillis() - start));
return iNrCachedTracks > 0;
}
void CLastFmManager::CacheTrackThumb(const int nrInitialTracksToAdd)
{
- unsigned int start = CTimeUtils::GetTimeMS();
+ unsigned int start = XbmcThreads::SystemClockMillis();
CSingleLock lock(m_lockCache);
int iNrCachedTracks = m_RadioTrackQueue->size();
CFileCurl http;
@@ -459,7 +460,7 @@ void CLastFmManager::CacheTrackThumb(const int nrInitialTracksToAdd)
item->GetMusicInfoTag()->SetLoaded();
}
}
- CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start));
+ CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(XbmcThreads::SystemClockMillis() - start));
}
void CLastFmManager::AddToPlaylist(const int nrTracks)
@@ -500,13 +501,13 @@ void CLastFmManager::OnSongChange(CFileItem& newSong)
}
else
{
- unsigned int start = CTimeUtils::GetTimeMS();
+ unsigned int start = XbmcThreads::SystemClockMillis();
ReapSongs();
MovePlaying();
Update();
SendUpdateMessage();
- CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start));
+ CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(XbmcThreads::SystemClockMillis() - start));
}
}
m_CurrentSong.IsLoved = false;
diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp
index 997172f61f..b82469836e 100644
--- a/xbmc/music/MusicDatabase.cpp
+++ b/xbmc/music/MusicDatabase.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "MusicDatabase.h"
#include "network/cddb.h"
@@ -1596,21 +1597,21 @@ void CMusicDatabase::EmptyCache()
bool CMusicDatabase::Search(const CStdString& search, CFileItemList &items)
{
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
// first grab all the artists that match
SearchArtists(search, items);
CLog::Log(LOGDEBUG, "%s Artist search in %i ms",
- __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS();
+ __FUNCTION__, XbmcThreads::SystemClockMillis() - time); time = XbmcThreads::SystemClockMillis();
// then albums that match
SearchAlbums(search, items);
CLog::Log(LOGDEBUG, "%s Album search in %i ms",
- __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS();
+ __FUNCTION__, XbmcThreads::SystemClockMillis() - time); time = XbmcThreads::SystemClockMillis();
// and finally songs
SearchSongs(search, items);
CLog::Log(LOGDEBUG, "%s Songs search in %i ms",
- __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS();
+ __FUNCTION__, XbmcThreads::SystemClockMillis() - time); time = XbmcThreads::SystemClockMillis();
return true;
}
@@ -2130,7 +2131,7 @@ int CMusicDatabase::Cleanup(CGUIDialogProgress *pDlgProgress)
if (NULL == m_pDB.get()) return ERROR_DATABASE;
if (NULL == m_pDS.get()) return ERROR_DATABASE;
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
CLog::Log(LOGNOTICE, "%s: Starting musicdatabase cleanup ..", __FUNCTION__);
// first cleanup any songs with invalid paths
@@ -2215,7 +2216,7 @@ int CMusicDatabase::Cleanup(CGUIDialogProgress *pDlgProgress)
pDlgProgress->SetPercentage(100);
pDlgProgress->Progress();
}
- time = CTimeUtils::GetTimeMS() - time;
+ time = XbmcThreads::SystemClockMillis() - time;
CLog::Log(LOGNOTICE, "%s: Cleaning musicdatabase done. Operation took %s", __FUNCTION__, StringUtils::SecondsToTimeString(time / 1000).c_str());
if (!Compress(false))
@@ -2626,7 +2627,7 @@ bool CMusicDatabase::GetArtistsNav(const CStdString& strBaseDir, CFileItemList&
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
CStdString strSQL = "select * from artist where (idArtist IN ";
@@ -2756,7 +2757,7 @@ bool CMusicDatabase::GetArtistsNav(const CStdString& strBaseDir, CFileItemList&
m_pDS->next();
}
- CLog::Log(LOGDEBUG,"Time to retrieve artists from dataset = %i", CTimeUtils::GetTimeMS() - time);
+ CLog::Log(LOGDEBUG,"Time to retrieve artists from dataset = %i", XbmcThreads::SystemClockMillis() - time);
// cleanup
m_pDS->close();
@@ -2924,10 +2925,10 @@ bool CMusicDatabase::GetAlbumsByWhere(const CStdString &baseDir, const CStdStrin
CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, sql.c_str());
// run query
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
if (!m_pDS->query(sql.c_str())) return false;
CLog::Log(LOGDEBUG, "%s - query took %i ms",
- __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS();
+ __FUNCTION__, XbmcThreads::SystemClockMillis() - time); time = XbmcThreads::SystemClockMillis();
int iRowsFound = m_pDS->num_rows();
if (iRowsFound == 0)
@@ -2977,7 +2978,7 @@ bool CMusicDatabase::GetSongsByWhere(const CStdString &baseDir, const CStdString
try
{
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
// We don't use PrepareSQL here, as the WHERE clause is already formatted.
CStdString strSQL = "select * from songview " + whereClause;
CLog::Log(LOGDEBUG, "%s query = %s", __FUNCTION__, strSQL.c_str());
@@ -3015,7 +3016,7 @@ bool CMusicDatabase::GetSongsByWhere(const CStdString &baseDir, const CStdString
}
// cleanup
m_pDS->close();
- CLog::Log(LOGDEBUG, "%s(%s) - took %d ms", __FUNCTION__, whereClause.c_str(), CTimeUtils::GetTimeMS() - time);
+ CLog::Log(LOGDEBUG, "%s(%s) - took %d ms", __FUNCTION__, whereClause.c_str(), XbmcThreads::SystemClockMillis() - time);
return true;
}
catch (...)
diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp
index 6e846908b2..5073620f2c 100644
--- a/xbmc/music/infoscanner/MusicInfoScanner.cpp
+++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "MusicInfoScanner.h"
#include "music/tags/MusicInfoTagLoaderFactory.h"
#include "MusicAlbumInfo.h"
@@ -73,7 +74,7 @@ void CMusicInfoScanner::Process()
{
try
{
- unsigned int tick = CTimeUtils::GetTimeMS();
+ unsigned int tick = XbmcThreads::SystemClockMillis();
m_musicDatabase.Open();
@@ -152,7 +153,7 @@ void CMusicInfoScanner::Process()
m_musicDatabase.Close();
CLog::Log(LOGDEBUG, "%s - Finished scan", __FUNCTION__);
- tick = CTimeUtils::GetTimeMS() - tick;
+ tick = XbmcThreads::SystemClockMillis() - tick;
CLog::Log(LOGNOTICE, "My Music: Scanning for music info using worker thread, operation took %s", StringUtils::SecondsToTimeString(tick / 1000).c_str());
}
bool bCanceled;
diff --git a/xbmc/music/karaoke/karaokelyricsmanager.cpp b/xbmc/music/karaoke/karaokelyricsmanager.cpp
index 263d3cf860..acdb59c55f 100644
--- a/xbmc/music/karaoke/karaokelyricsmanager.cpp
+++ b/xbmc/music/karaoke/karaokelyricsmanager.cpp
@@ -21,6 +21,7 @@
// C++ Implementation: karaokelyricsmanager
+#include "threads/SystemClock.h"
#include "Application.h"
#include "guilib/GUIWindowManager.h"
#include "settings/GUISettings.h"
@@ -139,7 +140,7 @@ void CKaraokeLyricsManager::ProcessSlow()
if ( g_application.IsPlaying() )
{
if ( m_karaokeSongPlaying )
- m_lastPlayedTime = CTimeUtils::GetTimeMS();
+ m_lastPlayedTime = XbmcThreads::SystemClockMillis();
return;
}
@@ -148,7 +149,7 @@ void CKaraokeLyricsManager::ProcessSlow()
return;
// If less than 750ms passed return; we're still processing STOP events
- if ( !m_lastPlayedTime || CTimeUtils::GetTimeMS() - m_lastPlayedTime < 750 )
+ if ( !m_lastPlayedTime || XbmcThreads::SystemClockMillis() - m_lastPlayedTime < 750 )
return;
m_karaokeSongPlayed = false; // so it won't popup again
diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp
index 12706f1c98..d066054849 100644
--- a/xbmc/music/windows/GUIWindowMusicBase.cpp
+++ b/xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "GUIUserMessages.h"
#include "GUIWindowMusicBase.h"
@@ -605,12 +606,12 @@ void CGUIWindowMusicBase::OnRetrieveMusicInfo(CFileItemList& items)
/// \brief Retrieve tag information for \e m_vecItems
void CGUIWindowMusicBase::RetrieveMusicInfo()
{
- unsigned int startTick = CTimeUtils::GetTimeMS();
+ unsigned int startTick = XbmcThreads::SystemClockMillis();
OnRetrieveMusicInfo(*m_vecItems);
CLog::Log(LOGDEBUG, "RetrieveMusicInfo() took %u msec",
- CTimeUtils::GetTimeMS() - startTick);
+ XbmcThreads::SystemClockMillis() - startTick);
}
/// \brief Add selected list/thumb control item to playlist and start playing
@@ -1282,13 +1283,13 @@ void CGUIWindowMusicBase::OnRetrieveMusicInfo(CFileItemList& items)
bool bShowProgress=!g_windowManager.HasModalDialog();
bool bProgressVisible=false;
- unsigned int tick=CTimeUtils::GetTimeMS();
+ unsigned int tick=XbmcThreads::SystemClockMillis();
while (m_musicInfoLoader.IsLoading())
{
if (bShowProgress)
{ // Do we have to init a progress dialog?
- unsigned int elapsed=CTimeUtils::GetTimeMS()-tick;
+ unsigned int elapsed=XbmcThreads::SystemClockMillis()-tick;
if (!bProgressVisible && elapsed>1500 && m_dlgProgress)
{ // tag loading takes more then 1.5 secs, show a progress dialog
diff --git a/xbmc/network/EventClient.cpp b/xbmc/network/EventClient.cpp
index d5a368293e..457bc9cd3e 100644
--- a/xbmc/network/EventClient.cpp
+++ b/xbmc/network/EventClient.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#ifdef HAS_EVENT_SERVER
@@ -805,7 +806,7 @@ bool CEventClient::GetMousePos(float& x, float& y)
bool CEventClient::CheckButtonRepeat(unsigned int &next)
{
- unsigned int now = CTimeUtils::GetTimeMS();
+ unsigned int now = XbmcThreads::SystemClockMillis();
if ( next == 0 )
{
diff --git a/xbmc/network/UPnP.cpp b/xbmc/network/UPnP.cpp
index 36ce279b51..74e2a3e10d 100644
--- a/xbmc/network/UPnP.cpp
+++ b/xbmc/network/UPnP.cpp
@@ -20,6 +20,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "threads/SystemClock.h"
#include "UPnP.h"
#include "utils/URIUtils.h"
#include "Application.h"
@@ -1068,7 +1069,7 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action,
items.m_strPath = parent_id;
if (!items.Load()) {
// cache anything that takes more than a second to retrieve
- unsigned int time = CTimeUtils::GetTimeMS() + 1000;
+ unsigned int time = XbmcThreads::SystemClockMillis() + 1000;
if (parent_id.StartsWith("virtualpath://upnproot")) {
CFileItemPtr item;
@@ -1089,7 +1090,7 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action,
CDirectory::GetDirectory((const char*)parent_id, items);
}
- if (items.CacheToDiscAlways() || (items.CacheToDiscIfSlow() && time < CTimeUtils::GetTimeMS())) {
+ if (items.CacheToDiscAlways() || (items.CacheToDiscIfSlow() && time < XbmcThreads::SystemClockMillis())) {
items.Save();
}
}
diff --git a/xbmc/network/UdpClient.cpp b/xbmc/network/UdpClient.cpp
index 95220db84f..8e1ef2e80b 100644
--- a/xbmc/network/UdpClient.cpp
+++ b/xbmc/network/UdpClient.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "UdpClient.h"
#ifdef _LINUX
#include <sys/ioctl.h>
@@ -192,7 +193,7 @@ void CUdpClient::Process()
CStdString message = messageBuffer;
CLog::Log(UDPCLIENT_DEBUG_LEVEL, "UDPCLIENT RX: %u\t\t<- '%s'",
- CTimeUtils::GetTimeMS(), message.c_str() );
+ XbmcThreads::SystemClockMillis(), message.c_str() );
// NOTE: You should consider locking access to the screen device
// or at least wait until after vertical refresh before firing off events
@@ -242,7 +243,7 @@ bool CUdpClient::DispatchNextCommand()
// only perform the following if logging level at debug
CLog::Log(UDPCLIENT_DEBUG_LEVEL, "UDPCLIENT TX: %u\t\t-> "
"<binary payload %u bytes>",
- CTimeUtils::GetTimeMS(), command.binarySize );
+ XbmcThreads::SystemClockMillis(), command.binarySize );
do
{
@@ -256,7 +257,7 @@ bool CUdpClient::DispatchNextCommand()
{
// only perform the following if logging level at debug
CLog::Log(UDPCLIENT_DEBUG_LEVEL, "UDPCLIENT TX: %u\t\t-> '%s'",
- CTimeUtils::GetTimeMS(), command.message.c_str() );
+ XbmcThreads::SystemClockMillis(), command.message.c_str() );
do
{
diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp
index ab48718cee..7ee0630831 100644
--- a/xbmc/pictures/GUIWindowPictures.cpp
+++ b/xbmc/pictures/GUIWindowPictures.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "GUIWindowPictures.h"
#include "Util.h"
@@ -200,13 +201,13 @@ void CGUIWindowPictures::OnPrepareFileItems(CFileItemList& items)
bool bShowProgress=!g_windowManager.HasModalDialog();
bool bProgressVisible=false;
- unsigned int tick=CTimeUtils::GetTimeMS();
+ unsigned int tick=XbmcThreads::SystemClockMillis();
while (loader.IsLoading() && m_dlgProgress && !m_dlgProgress->IsCanceled())
{
if (bShowProgress)
{ // Do we have to init a progress dialog?
- unsigned int elapsed=CTimeUtils::GetTimeMS()-tick;
+ unsigned int elapsed=XbmcThreads::SystemClockMillis()-tick;
if (!bProgressVisible && elapsed>1500 && m_dlgProgress)
{ // tag loading takes more then 1.5 secs, show a progress dialog
diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp
index 3fc7ca029d..0bee5218dc 100644
--- a/xbmc/pictures/GUIWindowSlideShow.cpp
+++ b/xbmc/pictures/GUIWindowSlideShow.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "GUIWindowSlideShow.h"
#include "Application.h"
@@ -95,12 +96,12 @@ void CBackgroundPicLoader::Process()
{
if (m_pCallback)
{
- unsigned int start = CTimeUtils::GetTimeMS();
+ unsigned int start = XbmcThreads::SystemClockMillis();
CBaseTexture* texture = new CTexture();
unsigned int originalWidth = 0;
unsigned int originalHeight = 0;
texture->LoadFromFile(m_strFileName, m_maxWidth, m_maxHeight, g_guiSettings.GetBool("pictures.useexifrotation"), &originalWidth, &originalHeight);
- totalTime += CTimeUtils::GetTimeMS() - start;
+ totalTime += XbmcThreads::SystemClockMillis() - start;
count++;
// tell our parent
bool bFullSize = ((int)texture->GetWidth() < m_maxWidth) && ((int)texture->GetHeight() < m_maxHeight);
diff --git a/xbmc/rendering/dx/RenderSystemDX.cpp b/xbmc/rendering/dx/RenderSystemDX.cpp
index b1b02cbf0c..39825436c9 100644
--- a/xbmc/rendering/dx/RenderSystemDX.cpp
+++ b/xbmc/rendering/dx/RenderSystemDX.cpp
@@ -22,6 +22,7 @@
#ifdef HAS_DX
+#include "threads/SystemClock.h"
#include "settings/Settings.h"
#include "RenderSystemDX.h"
#include "utils/log.h"
@@ -812,7 +813,7 @@ bool CRenderSystemDX::TestRender()
static DWORD lastTime = 0;
static float delta = 0;
- DWORD thisTime = CTimeUtils::GetTimeMS();
+ DWORD thisTime = XbmcThreads::SystemClockMillis();
if(thisTime - lastTime > 10)
{
diff --git a/xbmc/threads/Condition.h b/xbmc/threads/Condition.h
index b66669f8c2..b47063dbdd 100644
--- a/xbmc/threads/Condition.h
+++ b/xbmc/threads/Condition.h
@@ -23,7 +23,7 @@
#include "threads/platform/Condition.h"
-#include "threads/Time.h"
+#include "threads/SystemClock.h"
#include <stdio.h>
namespace XbmcThreads
@@ -46,7 +46,7 @@ namespace XbmcThreads
inline static unsigned long timeLeft(unsigned int endtime)
{
- unsigned int cur = currentClockMillis();
+ unsigned int cur = SystemClockMillis();
return endtime <= cur ? 0 : (endtime - cur);
}
@@ -59,7 +59,7 @@ namespace XbmcThreads
bool ret = true;
if (!predicate)
{
- unsigned int endtime = currentClockMillis() + milliseconds;
+ unsigned int endtime = SystemClockMillis() + milliseconds;
bool notdone = true;
while (notdone && ret == true)
{
diff --git a/xbmc/threads/Makefile b/xbmc/threads/Makefile
index 50d357bfda..2853248fe3 100644
--- a/xbmc/threads/Makefile
+++ b/xbmc/threads/Makefile
@@ -2,7 +2,7 @@ SRCS=Atomics.cpp \
Event.cpp \
LockFree.cpp \
Thread.cpp \
- Time.cpp \
+ SystemClock.cpp \
platform/Implementation.cpp
LIB=threads.a
diff --git a/xbmc/threads/Time.cpp b/xbmc/threads/SystemClock.cpp
index 54d2d9f00a..58cf120604 100644
--- a/xbmc/threads/Time.cpp
+++ b/xbmc/threads/SystemClock.cpp
@@ -37,7 +37,7 @@
namespace XbmcThreads
{
- unsigned int currentClockMillis()
+ unsigned int SystemClockMillis()
{
uint64_t now_time;
static uint64_t start_time = 0;
diff --git a/xbmc/threads/Time.h b/xbmc/threads/SystemClock.h
index 8802c860d2..95267371fa 100644
--- a/xbmc/threads/Time.h
+++ b/xbmc/threads/SystemClock.h
@@ -31,5 +31,5 @@ namespace XbmcThreads
*
* Of course, on windows it just calls timeGetTime, so you're on your own.
*/
- unsigned int currentClockMillis();
+ unsigned int SystemClockMillis();
}
diff --git a/xbmc/threads/Thread.cpp b/xbmc/threads/Thread.cpp
index 8703afc1b8..17783a0bc5 100644
--- a/xbmc/threads/Thread.cpp
+++ b/xbmc/threads/Thread.cpp
@@ -18,6 +18,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "threads/SystemClock.h"
#include "Thread.h"
#ifndef _LINUX
#include <process.h>
@@ -232,7 +233,7 @@ void CThread::Create(bool bAutoDelete, unsigned stacksize)
{
throw 1; //ERROR should not b possible!!!
}
- m_iLastTime = CTimeUtils::GetTimeMS() * 10000;
+ m_iLastTime = XbmcThreads::SystemClockMillis() * 10000;
m_iLastUsage = 0;
m_fLastUsage = 0.0f;
m_bAutoDelete = bAutoDelete;
@@ -476,7 +477,7 @@ void CThread::Process()
float CThread::GetRelativeUsage()
{
- unsigned __int64 iTime = CTimeUtils::GetTimeMS();
+ unsigned __int64 iTime = XbmcThreads::SystemClockMillis();
iTime *= 10000; // convert into 100ns tics
// only update every 1 second
diff --git a/xbmc/utils/AsyncFileCopy.cpp b/xbmc/utils/AsyncFileCopy.cpp
index 0ae81da920..a8edc073a6 100644
--- a/xbmc/utils/AsyncFileCopy.cpp
+++ b/xbmc/utils/AsyncFileCopy.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "AsyncFileCopy.h"
#include "dialogs/GUIDialogProgress.h"
#include "guilib/GUIWindowManager.h"
@@ -55,14 +56,14 @@ bool CAsyncFileCopy::Copy(const CStdString &from, const CStdString &to, const CS
// create our thread, which starts the file copy operation
Create();
CGUIDialogProgress *dlg = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
while (m_running)
{
m_event.WaitMSec(1000 / 30);
if (!m_running)
break;
// start the dialog up as needed
- if (dlg && !dlg->IsDialogRunning() && CTimeUtils::GetTimeMS() > time + 500) // wait 0.5 seconds before starting dialog
+ if (dlg && !dlg->IsDialogRunning() && XbmcThreads::SystemClockMillis() > time + 500) // wait 0.5 seconds before starting dialog
{
dlg->SetHeading(heading);
dlg->SetLine(0, url1.GetWithoutUserDetails());
diff --git a/xbmc/utils/RssReader.cpp b/xbmc/utils/RssReader.cpp
index 2a6d848a87..18fcdb4d8d 100644
--- a/xbmc/utils/RssReader.cpp
+++ b/xbmc/utils/RssReader.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "RssReader.h"
#include "utils/HTMLUtil.h"
#include "Application.h"
@@ -140,10 +141,10 @@ void CRssReader::Process()
strXML = "<rss><item><title>"+g_localizeStrings.Get(15301)+"</title></item></rss>";
else
{
- unsigned int starttime = CTimeUtils::GetTimeMS();
+ unsigned int starttime = XbmcThreads::SystemClockMillis();
while ( (!m_bStop) && (nRetries > 0) )
{
- unsigned int currenttimer = CTimeUtils::GetTimeMS() - starttime;
+ unsigned int currenttimer = XbmcThreads::SystemClockMillis() - starttime;
if (currenttimer > 15000)
{
CLog::Log(LOGERROR,"Timeout whilst retrieving %s", strUrl.c_str());
diff --git a/xbmc/utils/Stopwatch.cpp b/xbmc/utils/Stopwatch.cpp
index 6afeb4c7c4..b5d93a26a6 100644
--- a/xbmc/utils/Stopwatch.cpp
+++ b/xbmc/utils/Stopwatch.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "Stopwatch.h"
#if defined(_LINUX) && !defined(__APPLE__) && !defined(__FreeBSD__)
#include <sys/sysinfo.h>
@@ -102,6 +103,6 @@ int64_t CStopWatch::GetTicks() const
#ifndef _LINUX
return CurrentHostCounter();
#else
- return CTimeUtils::GetTimeMS();
+ return XbmcThreads::SystemClockMillis();
#endif
}
diff --git a/xbmc/utils/SystemInfo.cpp b/xbmc/utils/SystemInfo.cpp
index 1711f2d4cc..13338fdbff 100644
--- a/xbmc/utils/SystemInfo.cpp
+++ b/xbmc/utils/SystemInfo.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "SystemInfo.h"
#ifndef _LINUX
@@ -144,12 +145,12 @@ CStdString CSysInfoJob::GetSystemUpTime(bool bTotalUptime)
if(bTotalUptime)
{
//Total Uptime
- iInputMinutes = g_settings.m_iSystemTimeTotalUp + ((int)(CTimeUtils::GetTimeMS() / 60000));
+ iInputMinutes = g_settings.m_iSystemTimeTotalUp + ((int)(XbmcThreads::SystemClockMillis() / 60000));
}
else
{
//Current UpTime
- iInputMinutes = (int)(CTimeUtils::GetTimeMS() / 60000);
+ iInputMinutes = (int)(XbmcThreads::SystemClockMillis() / 60000);
}
SystemUpTime(iInputMinutes,iMinutes, iHours, iDays);
diff --git a/xbmc/utils/TimeUtils.cpp b/xbmc/utils/TimeUtils.cpp
index fcf066a4e1..2528b97485 100644
--- a/xbmc/utils/TimeUtils.cpp
+++ b/xbmc/utils/TimeUtils.cpp
@@ -21,7 +21,7 @@
#include "TimeUtils.h"
#include "XBDateTime.h"
-#include "threads/Time.h"
+#include "threads/SystemClock.h"
#ifdef __APPLE__
#if defined(__ppc__) || defined(__arm__)
@@ -70,7 +70,7 @@ unsigned int CTimeUtils::frameTime = 0;
void CTimeUtils::UpdateFrameTime()
{
- frameTime = GetTimeMS();
+ frameTime = XbmcThreads::SystemClockMillis();
}
unsigned int CTimeUtils::GetFrameTime()
@@ -78,11 +78,6 @@ unsigned int CTimeUtils::GetFrameTime()
return frameTime;
}
-unsigned int CTimeUtils::GetTimeMS()
-{
- return XbmcThreads::currentClockMillis();
-}
-
CDateTime CTimeUtils::GetLocalTime(time_t time)
{
CDateTime result;
diff --git a/xbmc/utils/TimeUtils.h b/xbmc/utils/TimeUtils.h
index 49965b4474..67abb94911 100644
--- a/xbmc/utils/TimeUtils.h
+++ b/xbmc/utils/TimeUtils.h
@@ -34,7 +34,6 @@ class CTimeUtils
public:
static void UpdateFrameTime(); ///< update the frame time. Not threadsafe
static unsigned int GetFrameTime(); ///< returns the frame time in MS. Not threadsafe
- static unsigned int GetTimeMS();
static CDateTime GetLocalTime(time_t time);
private:
diff --git a/xbmc/video/Teletext.cpp b/xbmc/video/Teletext.cpp
index f953b8bccd..4d6f381baf 100644
--- a/xbmc/video/Teletext.cpp
+++ b/xbmc/video/Teletext.cpp
@@ -26,6 +26,7 @@
* Many thanks to the TuxBox Teletext Team for this great work.
*/
+#include "threads/SystemClock.h"
#include "Teletext.h"
#include "Application.h"
#include "utils/log.h"
@@ -1182,7 +1183,7 @@ void CTeletextDecoder::RenderPage()
m_RenderInfo.SubtitleCache[j] = c;
}
c->Valid = true;
- c->Timestamp = CTimeUtils::GetTimeMS()/1000;
+ c->Timestamp = XbmcThreads::SystemClockMillis()/1000;
if (m_txtCache->SubPageTable[m_txtCache->Page] != 0xFF)
{
@@ -1222,7 +1223,7 @@ void CTeletextDecoder::RenderPage()
{
if (m_RenderInfo.DelayStarted)
{
- long now = CTimeUtils::GetTimeMS()/1000;
+ long now = XbmcThreads::SystemClockMillis()/1000;
for (int i = 0; i < SUBTITLE_CACHESIZE ; i++)
{
if (m_RenderInfo.SubtitleCache[i] && m_RenderInfo.SubtitleCache[i]->Valid && now - m_RenderInfo.SubtitleCache[i]->Timestamp >= (long)m_RenderInfo.SubtitleDelay)
@@ -1328,7 +1329,7 @@ void CTeletextDecoder::DoFlashing(int startrow)
/* Flashing */
TextPageAttr_t flashattr;
char flashchar;
- long flashphase = CTimeUtils::GetTimeMS() % 1000;
+ long flashphase = XbmcThreads::SystemClockMillis() % 1000;
int srow = startrow;
int erow = 24;
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp
index efa52e4d6a..bbff25afca 100644
--- a/xbmc/video/VideoDatabase.cpp
+++ b/xbmc/video/VideoDatabase.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "VideoDatabase.h"
#include "video/windows/GUIWindowVideoBase.h"
#include "utils/RegExp.h"
@@ -492,7 +493,7 @@ bool CVideoDatabase::GetPathsForTvShow(int idShow, vector<int>& paths)
int CVideoDatabase::RunQuery(const CStdString &sql)
{
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
int rows = -1;
if (m_pDS->query(sql.c_str()))
{
@@ -500,7 +501,7 @@ int CVideoDatabase::RunQuery(const CStdString &sql)
if (rows == 0)
m_pDS->close();
}
- CLog::Log(LOGDEBUG, "%s took %d ms for %d items query: %s", __FUNCTION__, CTimeUtils::GetTimeMS() - time, rows, sql.c_str());
+ CLog::Log(LOGDEBUG, "%s took %d ms for %d items query: %s", __FUNCTION__, XbmcThreads::SystemClockMillis() - time, rows, sql.c_str());
return rows;
}
@@ -2837,14 +2838,14 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMovie(auto_ptr<Dataset> &pDS, bool ne
CVideoInfoTag details;
details.Reset();
- DWORD time = CTimeUtils::GetTimeMS();
+ DWORD time = XbmcThreads::SystemClockMillis();
int idMovie = pDS->fv(0).get_asInt();
GetDetailsFromDB(pDS, VIDEODB_ID_MIN, VIDEODB_ID_MAX, DbMovieOffsets, details);
details.m_iDbId = idMovie;
GetCommonDetails(pDS, details);
- movieTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS();
+ movieTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis();
GetStreamDetails(details);
@@ -2864,7 +2865,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMovie(auto_ptr<Dataset> &pDS, bool ne
details.m_cast.push_back(info);
m_pDS2->next();
}
- castTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS();
+ castTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis();
details.m_strPictureURL.Parse();
// create sets string
@@ -2904,7 +2905,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForTvShow(auto_ptr<Dataset> &pDS, bool n
CVideoInfoTag details;
details.Reset();
- DWORD time = CTimeUtils::GetTimeMS();
+ DWORD time = XbmcThreads::SystemClockMillis();
int idTvShow = pDS->fv(0).get_asInt();
GetDetailsFromDB(pDS, VIDEODB_ID_TV_MIN, VIDEODB_ID_TV_MAX, DbTvShowOffsets, details, 1);
@@ -2914,7 +2915,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForTvShow(auto_ptr<Dataset> &pDS, bool n
details.m_playCount = m_pDS->fv(VIDEODB_DETAILS_TVSHOW_NUM_WATCHED).get_asInt();
details.m_strShowTitle = details.m_strTitle;
- movieTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS();
+ movieTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis();
if (needsCast)
{
@@ -2930,7 +2931,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForTvShow(auto_ptr<Dataset> &pDS, bool n
details.m_cast.push_back(info);
m_pDS2->next();
}
- castTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS();
+ castTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis();
details.m_strPictureURL.Parse();
}
return details;
@@ -2941,13 +2942,13 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(auto_ptr<Dataset> &pDS, bool
CVideoInfoTag details;
details.Reset();
- DWORD time = CTimeUtils::GetTimeMS();
+ DWORD time = XbmcThreads::SystemClockMillis();
int idEpisode = pDS->fv(0).get_asInt();
GetDetailsFromDB(pDS, VIDEODB_ID_EPISODE_MIN, VIDEODB_ID_EPISODE_MAX, DbEpisodeOffsets, details);
details.m_iDbId = idEpisode;
GetCommonDetails(pDS, details);
- movieTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS();
+ movieTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis();
details.m_strMPAARating = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_MPAA).get_asString();
details.m_strShowTitle = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_NAME).get_asString();
@@ -2996,7 +2997,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(auto_ptr<Dataset> &pDS, bool
}
}
}
- castTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS();
+ castTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis();
details.m_strPictureURL.Parse();
strSQL=PrepareSQL("select * from bookmark join episode on episode.c%02d=bookmark.idBookmark where episode.idEpisode=%i and bookmark.type=%i", VIDEODB_ID_EPISODE_BOOKMARK,details.m_iDbId,CBookmark::EPISODE);
m_pDS2->query(strSQL.c_str());
@@ -3012,13 +3013,13 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMusicVideo(auto_ptr<Dataset> &pDS)
CVideoInfoTag details;
details.Reset();
- DWORD time = CTimeUtils::GetTimeMS();
+ DWORD time = XbmcThreads::SystemClockMillis();
int idMovie = pDS->fv(0).get_asInt();
GetDetailsFromDB(pDS, VIDEODB_ID_MUSICVIDEO_MIN, VIDEODB_ID_MUSICVIDEO_MAX, DbMusicVideoOffsets, details);
details.m_iDbId = idMovie;
GetCommonDetails(pDS, details);
- movieTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS();
+ movieTime += XbmcThreads::SystemClockMillis() - time; time = XbmcThreads::SystemClockMillis();
GetStreamDetails(details);
GetResumePoint(details);
@@ -4068,7 +4069,7 @@ bool CVideoDatabase::GetSetsNav(const CStdString& strBaseDir, CFileItemList& ite
m_pDS->close();
}
-// CLog::Log(LOGDEBUG, "%s Time: %d ms", CTimeUtils::GetTimeMS() - time);
+// CLog::Log(LOGDEBUG, "%s Time: %d ms", XbmcThreads::SystemClockMillis() - time);
return true;
}
catch (...)
@@ -4170,7 +4171,7 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI
m_pDS->close();
}
-// CLog::Log(LOGDEBUG, __FUNCTION__" Time: %d ms", CTimeUtils::GetTimeMS() - time);
+// CLog::Log(LOGDEBUG, __FUNCTION__" Time: %d ms", XbmcThreads::SystemClockMillis() - time);
return true;
}
catch (...)
@@ -4263,10 +4264,10 @@ bool CVideoDatabase::GetPeopleNav(const CStdString& strBaseDir, CFileItemList& i
}
// run query
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
if (!m_pDS->query(strSQL.c_str())) return false;
CLog::Log(LOGDEBUG, "%s - query took %i ms",
- __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS();
+ __FUNCTION__, XbmcThreads::SystemClockMillis() - time); time = XbmcThreads::SystemClockMillis();
int iRowsFound = m_pDS->num_rows();
if (iRowsFound == 0)
{
@@ -4344,7 +4345,7 @@ bool CVideoDatabase::GetPeopleNav(const CStdString& strBaseDir, CFileItemList& i
m_pDS->close();
}
CLog::Log(LOGDEBUG, "%s item retrieval took %i ms",
- __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS();
+ __FUNCTION__, XbmcThreads::SystemClockMillis() - time); time = XbmcThreads::SystemClockMillis();
return true;
}
@@ -5855,7 +5856,7 @@ bool CVideoDatabase::GetMusicVideosByWhere(const CStdString &baseDir, const CStd
{
try
{
- DWORD time = CTimeUtils::GetTimeMS();
+ DWORD time = XbmcThreads::SystemClockMillis();
movieTime = 0;
castTime = 0;
@@ -5869,7 +5870,7 @@ bool CVideoDatabase::GetMusicVideosByWhere(const CStdString &baseDir, const CStd
// run query
if (!m_pDS->query(strSQL.c_str()))
return false;
- CLog::Log(LOGDEBUG, "%s time for actual SQL query = %d", __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS();
+ CLog::Log(LOGDEBUG, "%s time for actual SQL query = %d", __FUNCTION__, XbmcThreads::SystemClockMillis() - time); time = XbmcThreads::SystemClockMillis();
int iRowsFound = m_pDS->num_rows();
if (iRowsFound == 0)
@@ -5896,7 +5897,7 @@ bool CVideoDatabase::GetMusicVideosByWhere(const CStdString &baseDir, const CStd
m_pDS->next();
}
- CLog::Log(LOGDEBUG, "%s time to retrieve from dataset = %d", __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS();
+ CLog::Log(LOGDEBUG, "%s time to retrieve from dataset = %d", __FUNCTION__, XbmcThreads::SystemClockMillis() - time); time = XbmcThreads::SystemClockMillis();
// cleanup
m_pDS->close();
@@ -6416,7 +6417,7 @@ void CVideoDatabase::CleanDatabase(IVideoInfoScannerObserver* pObserver, const v
if (NULL == m_pDB.get()) return;
if (NULL == m_pDS.get()) return;
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
CLog::Log(LOGNOTICE, "%s: Starting videodatabase cleanup ..", __FUNCTION__);
BeginTransaction();
@@ -6792,7 +6793,7 @@ void CVideoDatabase::CleanDatabase(IVideoInfoScannerObserver* pObserver, const v
CUtil::DeleteVideoDatabaseDirectoryCache();
- time = CTimeUtils::GetTimeMS() - time;
+ time = XbmcThreads::SystemClockMillis() - time;
CLog::Log(LOGNOTICE, "%s: Cleaning videodatabase done. Operation took %s", __FUNCTION__, StringUtils::SecondsToTimeString(time / 1000).c_str());
for (unsigned int i = 0; i < movieIDs.size(); i++)
diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp
index 15fbd2253a..3bb9f62d04 100644
--- a/xbmc/video/VideoInfoScanner.cpp
+++ b/xbmc/video/VideoInfoScanner.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "FileItem.h"
#include "VideoInfoScanner.h"
#include "addons/AddonManager.h"
@@ -71,7 +72,7 @@ namespace VIDEO
{
try
{
- unsigned int tick = CTimeUtils::GetTimeMS();
+ unsigned int tick = XbmcThreads::SystemClockMillis();
m_database.Open();
@@ -121,7 +122,7 @@ namespace VIDEO
m_database.Close();
- tick = CTimeUtils::GetTimeMS() - tick;
+ tick = XbmcThreads::SystemClockMillis() - tick;
CLog::Log(LOGNOTICE, "VideoInfoScanner: Finished scan. Scanning for video info took %s", StringUtils::SecondsToTimeString(tick / 1000).c_str());
m_bRunning = false;
diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp
index f1ef4d8d74..ac2c911266 100644
--- a/xbmc/video/windows/GUIWindowFullScreen.cpp
+++ b/xbmc/video/windows/GUIWindowFullScreen.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "system.h"
#include "GUIWindowFullScreen.h"
#include "Application.h"
@@ -440,7 +441,7 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
#endif
}
m_bShowViewModeInfo = true;
- m_dwShowViewModeTimeout = CTimeUtils::GetTimeMS();
+ m_dwShowViewModeTimeout = XbmcThreads::SystemClockMillis();
}
return true;
break;
@@ -753,7 +754,7 @@ void CGUIWindowFullScreen::FrameMove()
//----------------------
// ViewMode Information
//----------------------
- if (m_bShowViewModeInfo && CTimeUtils::GetTimeMS() - m_dwShowViewModeTimeout > 2500)
+ if (m_bShowViewModeInfo && XbmcThreads::SystemClockMillis() - m_dwShowViewModeTimeout > 2500)
{
m_bShowViewModeInfo = false;
}
@@ -807,7 +808,7 @@ void CGUIWindowFullScreen::FrameMove()
if (m_timeCodeShow && m_timeCodePosition != 0)
{
- if ( (CTimeUtils::GetTimeMS() - m_timeCodeTimeout) >= 2500)
+ if ( (XbmcThreads::SystemClockMillis() - m_timeCodeTimeout) >= 2500)
{
m_timeCodeShow = false;
m_timeCodePosition = 0;
@@ -926,7 +927,7 @@ void CGUIWindowFullScreen::ChangetheTimeCode(int remote)
if (remote >= REMOTE_0 && remote <= REMOTE_9)
{
m_timeCodeShow = true;
- m_timeCodeTimeout = CTimeUtils::GetTimeMS();
+ m_timeCodeTimeout = XbmcThreads::SystemClockMillis();
if (m_timeCodePosition < 6)
m_timeCodeStamp[m_timeCodePosition++] = remote - REMOTE_0;
diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp
index 1c93b6058e..2545ac5bed 100644
--- a/xbmc/windows/GUIMediaWindow.cpp
+++ b/xbmc/windows/GUIMediaWindow.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "threads/SystemClock.h"
#include "GUIMediaWindow.h"
#include "GUIUserMessages.h"
#include "Util.h"
@@ -623,7 +624,7 @@ bool CGUIMediaWindow::GetDirectory(const CStdString &strDirectory, CFileItemList
}
else
{
- unsigned int time = CTimeUtils::GetTimeMS();
+ unsigned int time = XbmcThreads::SystemClockMillis();
if (strDirectory.IsEmpty())
SetupShares();
@@ -632,7 +633,7 @@ bool CGUIMediaWindow::GetDirectory(const CStdString &strDirectory, CFileItemList
return false;
// took over a second, and not normally cached, so cache it
- if (time + 1000 < CTimeUtils::GetTimeMS() && items.CacheToDiscIfSlow())
+ if (time + 1000 < XbmcThreads::SystemClockMillis() && items.CacheToDiscIfSlow())
items.Save(GetID());
// if these items should replace the current listing, then pop it off the top