diff options
author | davilla <davilla@svn> | 2009-10-07 04:58:24 +0000 |
---|---|---|
committer | davilla <davilla@svn> | 2009-10-07 04:58:24 +0000 |
commit | f16ccd01194f3aad2efeff60870b2cd022a12f88 (patch) | |
tree | 03ec73aec6332af4bdac41a1aff386f005db484f | |
parent | 2647224a35cfd9452659e3853ab66963b866110b (diff) |
[all] replace winapi timeGetTime/GetTickCOunt with CTimeUtils::GetTimeMS. Will need linux/win verify.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23494 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
72 files changed, 336 insertions, 327 deletions
diff --git a/guilib/common/IRServerSuite/IRServerSuite.cpp b/guilib/common/IRServerSuite/IRServerSuite.cpp index ec571d1f4a..6a2d25b50f 100644 --- a/guilib/common/IRServerSuite/IRServerSuite.cpp +++ b/guilib/common/IRServerSuite/IRServerSuite.cpp @@ -24,6 +24,7 @@ #include "ButtonTranslator.h" #include "log.h" #include "AdvancedSettings.h" +#include "utils/TimeUtils.h" #define IRSS_PORT 24000 @@ -83,14 +84,14 @@ void CRemoteControl::Process() { int iTries = 1; DWORD iMsRetryDelay = 5000; - DWORD time = timeGetTime() - iMsRetryDelay; + DWORD time = CTimeUtils::GetTimeMS() - iMsRetryDelay; // try to connect 6 times @ a 5 second interval (30 seconds) // multiple tries because irss service might be up and running a little later then xbmc on boot. while (!m_bStop && iTries <= 6) { - if (timeGetTime() - time >= iMsRetryDelay) + if (CTimeUtils::GetTimeMS() - time >= iMsRetryDelay) { - time = timeGetTime(); + time = CTimeUtils::GetTimeMS(); if (Connect()) break; iTries++; diff --git a/guilib/common/LIRC.cpp b/guilib/common/LIRC.cpp index e8aa1c1e71..d21add8205 100644 --- a/guilib/common/LIRC.cpp +++ b/guilib/common/LIRC.cpp @@ -10,6 +10,7 @@ #include "log.h" #include "AdvancedSettings.h" #include "FileSystem/File.h" +#include "utils/TimeUtils.h" #define LIRC_DEVICE "/dev/lircd" @@ -91,7 +92,7 @@ void CRemoteControl::setDeviceName(const CStdString& value) void CRemoteControl::Initialize() { struct sockaddr_un addr; - int now = timeGetTime(); + int now = CTimeUtils::GetTimeMS(); if (!m_used || now < m_lastInitAttempt + m_initRetryPeriod) return; diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 20c6c3126e..e3615ee8fe 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2235,7 +2235,7 @@ void CApplication::Render() { // frame rate limiter (really bad, but it does the trick :p) static unsigned int lastFrameTime = 0; - unsigned int currentTime = timeGetTime(); + unsigned int currentTime = CTimeUtils::GetTimeMS(); int nDelayTime = 0; // Less fps in DPMS or Black screensaver bool lowfps = (m_dpmsIsActive @@ -2295,7 +2295,7 @@ void CApplication::Render() } } - lastFrameTime = timeGetTime(); + lastFrameTime = CTimeUtils::GetTimeMS(); } g_graphicsContext.Lock(); @@ -2839,7 +2839,7 @@ void CApplication::UpdateLCD() long lTimeOut = 1000; if ( m_iPlaySpeed != 1) lTimeOut = 0; - if ( ((long)GetTickCount() - lTickCount) >= lTimeOut) + if ( ((long)CTimeUtils::GetTimeMS() - lTickCount) >= lTimeOut) { if (g_application.NavigationIdleTime() < 5) g_lcd->Render(ILCD::LCD_MODE_NAVIGATION); @@ -2853,7 +2853,7 @@ void CApplication::UpdateLCD() g_lcd->Render(ILCD::LCD_MODE_GENERAL); // reset tick count - lTickCount = GetTickCount(); + lTickCount = CTimeUtils::GetTimeMS(); } #endif } diff --git a/xbmc/ApplicationRenderer.cpp b/xbmc/ApplicationRenderer.cpp index 005f600864..84c202b537 100644 --- a/xbmc/ApplicationRenderer.cpp +++ b/xbmc/ApplicationRenderer.cpp @@ -27,6 +27,7 @@ #include "WindowingFactory.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" CApplicationRenderer g_ApplicationRenderer; @@ -41,7 +42,7 @@ CApplicationRenderer::~CApplicationRenderer() void CApplicationRenderer::OnStartup() { - m_time = timeGetTime(); + m_time = CTimeUtils::GetTimeMS(); m_enabled = true; m_busyShown = false; m_explicitbusy = 0; @@ -110,12 +111,12 @@ void CApplicationRenderer::Process() float t0 = (1000.0f/g_graphicsContext.GetFPS()); float t1 = m_time + t0; //time when we expect a new render - float t2 = (float)timeGetTime(); + float t2 = (float)CTimeUtils::GetTimeMS(); if (t1 < t2) //we're late rendering { try { - if (timeGetTime() >= (m_time + g_advancedSettings.m_busyDialogDelay)) + if (CTimeUtils::GetTimeMS() >= (m_time + g_advancedSettings.m_busyDialogDelay)) { CSingleLock lockg (g_graphicsContext); if (m_prevbusycount != m_busycount) @@ -137,7 +138,7 @@ void CApplicationRenderer::Process() if ((g_windowManager.HasModalDialog() && (g_windowManager.GetTopMostModalDialogID() != WINDOW_VIDEO_INFO) && (g_windowManager.GetTopMostModalDialogID() != WINDOW_MUSIC_INFO)) || (g_windowManager.GetTopMostModalDialogID() == WINDOW_DIALOG_PROGRESS)) { //TODO: render progress dialog here instead of in dialog::Progress - m_time = timeGetTime(); + m_time = CTimeUtils::GetTimeMS(); lockg.Leave(); Sleep(1); continue; @@ -313,7 +314,7 @@ void CApplicationRenderer::Render(bool bFullscreen) { g_application.DoRender(); } - m_time = timeGetTime(); + m_time = CTimeUtils::GetTimeMS(); Enable(); } diff --git a/xbmc/Credits.cpp b/xbmc/Credits.cpp index 618f71cefc..02e333890b 100644 --- a/xbmc/Credits.cpp +++ b/xbmc/Credits.cpp @@ -33,6 +33,7 @@ #include "SkinInfo.h" #include "GUIFont.h" #include "FileSystem/SpecialProtocol.h" +#include "utils/TimeUtils.h" using namespace std; @@ -1153,7 +1154,7 @@ void RunCredits() // restore gamma D3DDevice::SetGammaRamp(D3DSGR_IMMEDIATE, &StartRamp); - DWORD StartTime = timeGetTime(); + DWORD StartTime = CTimeUtils::GetTimeMS(); DWORD LastTime = StartTime; DWORD LastCreditTime = 0; @@ -1174,7 +1175,7 @@ void RunCredits() if (WaitForSingleObject(hMusicThread, 0) == WAIT_TIMEOUT) Time = (DWORD)mikxboxGetPTS(); else - Time = timeGetTime() - StartTime; + Time = CTimeUtils::GetTimeMS() - StartTime; if (Time < LastTime) { diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index 2d777267a9..70ec5c9dd7 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -53,6 +53,7 @@ #include "GUISettings.h" #include "AdvancedSettings.h" #include "Settings.h" +#include "utils/TimeUtils.h" using namespace std; using namespace XFILE; @@ -1455,9 +1456,9 @@ void CFileItemList::Reserve(int iCount) void CFileItemList::Sort(FILEITEMLISTCOMPARISONFUNC func) { CSingleLock lock(m_lock); - DWORD dwStart = GetTickCount(); + DWORD dwStart = CTimeUtils::GetTimeMS(); std::sort(m_items.begin(), m_items.end(), func); - DWORD dwElapsed = GetTickCount() - dwStart; + DWORD dwElapsed = CTimeUtils::GetTimeMS() - dwStart; CLog::Log(LOGDEBUG,"%s, sorting took %u millis", __FUNCTION__, dwElapsed); } diff --git a/xbmc/FileSystem/CMythFile.cpp b/xbmc/FileSystem/CMythFile.cpp index 2626e4f6c1..c4a6402433 100644 --- a/xbmc/FileSystem/CMythFile.cpp +++ b/xbmc/FileSystem/CMythFile.cpp @@ -25,6 +25,7 @@ #include "URL.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" extern "C" { #include "lib/libcmyth/cmyth.h" @@ -233,7 +234,7 @@ bool CCMythFile::SetupLiveTV(const CURL& url) } m_program = m_dll->recorder_get_cur_proginfo(m_recorder); - m_timestamp = GetTickCount(); + m_timestamp = CTimeUtils::GetTimeMS(); if(m_program) m_starttime = m_dll->proginfo_rec_start(m_program); @@ -503,9 +504,9 @@ bool CCMythFile::UpdateItem(CFileItem& item) int CCMythFile::GetTotalTime() { - if(m_recorder && m_timestamp + 5000 < GetTickCount()) + if(m_recorder && m_timestamp + 5000 < CTimeUtils::GetTimeMS()) { - m_timestamp = GetTickCount(); + m_timestamp = CTimeUtils::GetTimeMS(); if(m_program) m_dll->ref_release(m_program); m_program = m_dll->recorder_get_cur_proginfo(m_recorder); diff --git a/xbmc/FileSystem/CMythSession.cpp b/xbmc/FileSystem/CMythSession.cpp index fc542f42a5..8fc237b658 100644 --- a/xbmc/FileSystem/CMythSession.cpp +++ b/xbmc/FileSystem/CMythSession.cpp @@ -29,6 +29,7 @@ #include "StringUtils.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" extern "C" { @@ -55,7 +56,7 @@ void CCMythSession::CheckIdle() for (it = m_sessions.begin(); it != m_sessions.end(); ) { CCMythSession* session = *it; - if (session->m_timestamp + 5000 < GetTickCount()) + if (session->m_timestamp + 5000 < CTimeUtils::GetTimeMS()) { CLog::Log(LOGINFO, "%s - closing idle connection to MythTV backend: %s", __FUNCTION__, session->m_hostname.c_str()); delete session; @@ -88,7 +89,7 @@ CCMythSession* CCMythSession::AquireSession(const CURL& url) void CCMythSession::ReleaseSession(CCMythSession* session) { session->SetListener(NULL); - session->m_timestamp = GetTickCount(); + session->m_timestamp = CTimeUtils::GetTimeMS(); CSingleLock lock(m_section_session); m_sessions.push_back(session); } @@ -189,7 +190,7 @@ CCMythSession::CCMythSession(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 = GetTickCount(); + m_timestamp = CTimeUtils::GetTimeMS(); m_dll = new DllLibCMyth; m_dll->Load(); if (m_dll->IsLoaded()) diff --git a/xbmc/FileSystem/CacheMemBuffer.cpp b/xbmc/FileSystem/CacheMemBuffer.cpp index cfd4d92321..fbbc3c8481 100644 --- a/xbmc/FileSystem/CacheMemBuffer.cpp +++ b/xbmc/FileSystem/CacheMemBuffer.cpp @@ -25,6 +25,7 @@ #include "CacheMemBuffer.h" #include "utils/log.h" #include "utils/SingleLock.h" +#include "utils/TimeUtils.h" #include <math.h> @@ -132,8 +133,8 @@ int64_t CacheMemBuffer::WaitForData(unsigned int iMinAvail, unsigned int iMillis if (iMillis == 0 || IsEndOfInput()) return m_buffer.GetMaxReadSize(); - DWORD dwTime = GetTickCount() + iMillis; - while (!IsEndOfInput() && (unsigned int) m_buffer.GetMaxReadSize() < iMinAvail && GetTickCount() < dwTime ) + DWORD dwTime = CTimeUtils::GetTimeMS() + iMillis; + while (!IsEndOfInput() && (unsigned int) m_buffer.GetMaxReadSize() < iMinAvail && CTimeUtils::GetTimeMS() < dwTime ) Sleep(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 63d2f82547..a943d3b5ff 100644 --- a/xbmc/FileSystem/CacheStrategy.cpp +++ b/xbmc/FileSystem/CacheStrategy.cpp @@ -26,6 +26,7 @@ #include "Util.h" #include "utils/log.h" #include "utils/SingleLock.h" +#include "utils/TimeUtils.h" #ifdef _WIN32 #include "PlatformDefs.h" //for PRIdS, PRId64 #endif @@ -180,9 +181,9 @@ int64_t CSimpleFileCache::WaitForData(unsigned int iMinAvail, unsigned int iMill if( iMillis == 0 || IsEndOfInput() ) return GetAvailableRead(); - DWORD dwTimeout = GetTickCount() + iMillis; + DWORD dwTimeout = CTimeUtils::GetTimeMS() + iMillis; DWORD dwTime; - while ( !IsEndOfInput() && (dwTime = GetTickCount()) < dwTimeout ) + while ( !IsEndOfInput() && (dwTime = CTimeUtils::GetTimeMS()) < dwTimeout ) { int64_t iAvail = GetAvailableRead(); if (iAvail >= iMinAvail) diff --git a/xbmc/FileSystem/DllLibCurl.cpp b/xbmc/FileSystem/DllLibCurl.cpp index 80d2f58a2e..ab6f179bf9 100644 --- a/xbmc/FileSystem/DllLibCurl.cpp +++ b/xbmc/FileSystem/DllLibCurl.cpp @@ -23,6 +23,7 @@ #include "DllLibCurl.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" #include <assert.h> @@ -81,7 +82,7 @@ void DllLibCurlGlobal::CheckIdle() VEC_CURLSESSIONS::iterator it = m_sessions.begin(); while(it != m_sessions.end()) { - if( !it->m_busy && it->m_idletimestamp + idletime < GetTickCount()) + if( !it->m_busy && it->m_idletimestamp + idletime < CTimeUtils::GetTimeMS()) { 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); @@ -195,7 +196,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 = GetTickCount(); + it->m_idletimestamp = CTimeUtils::GetTimeMS(); return; } } diff --git a/xbmc/FileSystem/FileShoutcast.cpp b/xbmc/FileSystem/FileShoutcast.cpp index 7ee4f985ec..007dd6c062 100644 --- a/xbmc/FileSystem/FileShoutcast.cpp +++ b/xbmc/FileSystem/FileShoutcast.cpp @@ -31,6 +31,7 @@ #include "GUIDialogProgress.h" #include "GUIWindowManager.h" #include "URL.h" +#include "utils/TimeUtils.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -211,7 +212,7 @@ int64_t CFileShoutcast::GetLength() bool CFileShoutcast::Open(const CURL& url) { - m_dwLastTime = timeGetTime(); + m_dwLastTime = CTimeUtils::GetTimeMS(); int ret; CGUIDialogProgress* dlgProgress = NULL; @@ -380,9 +381,9 @@ unsigned int CFileShoutcast::Read(void* lpBuf, int64_t uiBufSize) if (iRead > uiBufSize) iRead = (int)uiBufSize; m_ringbuf.ReadBinary((char*)lpBuf, iRead); - if (timeGetTime() - m_dwLastTime > 500) + if (CTimeUtils::GetTimeMS() - m_dwLastTime > 500) { - m_dwLastTime = timeGetTime(); + m_dwLastTime = CTimeUtils::GetTimeMS(); CMusicInfoTag tag; GetMusicInfoTag(tag); g_infoManager.SetCurrentSongTag(tag); diff --git a/xbmc/FileSystem/FileSmb.cpp b/xbmc/FileSystem/FileSmb.cpp index df3604c3ee..56541b6865 100644 --- a/xbmc/FileSystem/FileSmb.cpp +++ b/xbmc/FileSystem/FileSmb.cpp @@ -38,6 +38,7 @@ #include "GUISettings.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace XFILE; using namespace DIRECTORY; @@ -188,7 +189,7 @@ void CSMB::Init() } } #ifdef _LINUX - m_LastActive = timeGetTime(); + m_LastActive = CTimeUtils::GetTimeMS(); #endif } @@ -300,7 +301,7 @@ void CSMB::CheckIfIdle() if (m_OpenConnections == 0) { /* I've set the the maxiumum IDLE time to be 1 min and 30 sec. */ CSingleLock lock(*this); - if (m_OpenConnections == 0 /* check again - when locked */ && m_context != NULL && (timeGetTime() - m_LastActive) > 90000) + if (m_OpenConnections == 0 /* check again - when locked */ && m_context != NULL && (CTimeUtils::GetTimeMS() - m_LastActive) > 90000) { CLog::Log(LOGNOTICE, "Samba is idle. Closing the remaining connections"); smb.Deinit(); @@ -310,7 +311,7 @@ void CSMB::CheckIfIdle() void CSMB::SetActivityTime() { - m_LastActive = timeGetTime(); + m_LastActive = CTimeUtils::GetTimeMS(); } /* The following two function is used to keep track on how many Opened files/directories there are. @@ -326,7 +327,7 @@ void CSMB::AddIdleConnection() m_OpenConnections--; /* If we close a file we reset the idle timer so that we don't have any wierd behaviours if a user leaves the movie paused for a long while and then press stop */ - m_LastActive = timeGetTime(); + m_LastActive = CTimeUtils::GetTimeMS(); } #endif diff --git a/xbmc/FileSystem/HDHomeRun.cpp b/xbmc/FileSystem/HDHomeRun.cpp index 5ffcdfe838..f11d6fe1b3 100644 --- a/xbmc/FileSystem/HDHomeRun.cpp +++ b/xbmc/FileSystem/HDHomeRun.cpp @@ -24,6 +24,7 @@ #include "URL.h" #include "FileItem.h" #include "HDHomeRun.h" +#include "utils/TimeUtils.h" using namespace XFILE; using namespace DIRECTORY; @@ -229,7 +230,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. - DWORD timestamp = GetTickCount() + 5000; + DWORD timestamp = CTimeUtils::GetTimeMS() + 5000; while(1) { datasize = (unsigned int)min((unsigned int) uiBufSize,UINT_MAX); @@ -240,7 +241,7 @@ unsigned int CFileHomeRun::Read(void* lpBuf, int64_t uiBufSize) return datasize; } - if(GetTickCount() > timestamp) + if(CTimeUtils::GetTimeMS() > timestamp) return 0; Sleep(64); diff --git a/xbmc/FileSystem/HTSPDirectory.cpp b/xbmc/FileSystem/HTSPDirectory.cpp index a3275ef498..91be858e0a 100644 --- a/xbmc/FileSystem/HTSPDirectory.cpp +++ b/xbmc/FileSystem/HTSPDirectory.cpp @@ -27,6 +27,7 @@ #include "cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" extern "C" { #include "lib/libhts/htsmsg.h" @@ -58,7 +59,7 @@ struct STimedOut { STimedOut(DWORD idle) : m_idle(idle) { - m_time = GetTickCount(); + m_time = CTimeUtils::GetTimeMS(); } bool operator()(SSession& data) { @@ -129,7 +130,7 @@ void CHTSPDirectorySession::Release(CHTSPDirectorySession* &session) if(it->session == session) { it->refs--; - it->last = GetTickCount(); + it->last = CTimeUtils::GetTimeMS(); return; } } diff --git a/xbmc/FileSystem/MultiPathDirectory.cpp b/xbmc/FileSystem/MultiPathDirectory.cpp index a4c05ce20d..9e9ed59ea2 100644 --- a/xbmc/FileSystem/MultiPathDirectory.cpp +++ b/xbmc/FileSystem/MultiPathDirectory.cpp @@ -28,6 +28,7 @@ #include "FileItem.h" #include "StringUtils.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace std; using namespace DIRECTORY; @@ -53,14 +54,14 @@ bool CMultiPathDirectory::GetDirectory(const CStdString& strPath, CFileItemList if (!GetPaths(strPath, vecPaths)) return false; - DWORD progressTime = timeGetTime() + 3000L; // 3 seconds before showing progress bar + DWORD progressTime = CTimeUtils::GetTimeMS() + 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 (timeGetTime() > progressTime && !dlgProgress) + if (CTimeUtils::GetTimeMS() > 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()); - DWORD dwTime=GetTickCount(); + DWORD dwTime = CTimeUtils::GetTimeMS(); 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(), GetTickCount()-dwTime); + items.Size(), CTimeUtils::GetTimeMS() - dwTime); } bool CMultiPathDirectory::SupportsFileOperations(const CStdString &strPath) diff --git a/xbmc/FileSystem/MusicSearchDirectory.cpp b/xbmc/FileSystem/MusicSearchDirectory.cpp index 1e1c3c2c55..a6ca1c9d6d 100644 --- a/xbmc/FileSystem/MusicSearchDirectory.cpp +++ b/xbmc/FileSystem/MusicSearchDirectory.cpp @@ -24,6 +24,7 @@ #include "URL.h" #include "FileItem.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace XFILE; using namespace DIRECTORY; @@ -48,13 +49,13 @@ bool CMusicSearchDirectory::GetDirectory(const CStdString& strPath, CFileItemLis // and retrieve the search details items.m_strPath = strPath; - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); CMusicDatabase db; db.Open(); db.Search(search, items); db.Close(); CLog::Log(LOGDEBUG, "%s (%s) took %u ms", - __FUNCTION__, strPath.c_str(), timeGetTime() - time); + __FUNCTION__, strPath.c_str(), CTimeUtils::GetTimeMS() - time); return true; } diff --git a/xbmc/FileSystem/PluginDirectory.cpp b/xbmc/FileSystem/PluginDirectory.cpp index 700efa95fb..9a5bb53eb9 100644 --- a/xbmc/FileSystem/PluginDirectory.cpp +++ b/xbmc/FileSystem/PluginDirectory.cpp @@ -35,6 +35,7 @@ #include "FileItem.h" #include "LocalizeStrings.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace DIRECTORY; using namespace std; @@ -503,7 +504,7 @@ bool CPluginDirectory::WaitOnScriptResult(const CStdString &scriptPath, const CS const unsigned int timeBeforeProgressBar = 1500; const unsigned int timeToKillScript = 1000; - DWORD startTime = timeGetTime(); + DWORD startTime = CTimeUtils::GetTimeMS(); CGUIDialogProgress *progressBar = NULL; CLog::Log(LOGDEBUG, "%s - waiting on the %s plugin...", __FUNCTION__, scriptName.c_str()); @@ -527,7 +528,7 @@ bool CPluginDirectory::WaitOnScriptResult(const CStdString &scriptPath, const CS } // check whether we should pop up the progress dialog - if (!progressBar && timeGetTime() - startTime > timeBeforeProgressBar) + if (!progressBar && CTimeUtils::GetTimeMS() - startTime > timeBeforeProgressBar) { // loading takes more then 1.5 secs, show a progress dialog progressBar = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); if (progressBar) @@ -558,9 +559,9 @@ bool CPluginDirectory::WaitOnScriptResult(const CStdString &scriptPath, const CS if (!m_cancelled) { m_cancelled = true; - startTime = timeGetTime(); + startTime = CTimeUtils::GetTimeMS(); } - if (m_cancelled && timeGetTime() - startTime > timeToKillScript) + if (m_cancelled && CTimeUtils::GetTimeMS() - 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 d59394cb3b..c9a007cd04 100644 --- a/xbmc/FileSystem/SAPDirectory.cpp +++ b/xbmc/FileSystem/SAPDirectory.cpp @@ -26,6 +26,7 @@ #include "FileItem.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" #ifdef __APPLE__ #include "OSXGNUReplacements.h" // strnlen #endif @@ -341,7 +342,7 @@ bool CSAPSessions::ParseAnnounce(char* data, int len) } // should be improved in the case of sdp - it->timeout = GetTickCount() + 60*60*1000; + it->timeout = CTimeUtils::GetTimeMS() + 60*60*1000; return true; } } @@ -368,7 +369,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 = GetTickCount() + 60*60*1000; + session.timeout = CTimeUtils::GetTimeMS() + 60*60*1000; m_sessions.push_back(session); CGUIMessage message(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_PATH); diff --git a/xbmc/FileSystem/VirtualPathDirectory.cpp b/xbmc/FileSystem/VirtualPathDirectory.cpp index b9919a856e..1a3b8308b7 100644 --- a/xbmc/FileSystem/VirtualPathDirectory.cpp +++ b/xbmc/FileSystem/VirtualPathDirectory.cpp @@ -28,6 +28,7 @@ #include "GUIDialogProgress.h" #include "FileItem.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace std; using namespace DIRECTORY; @@ -48,14 +49,14 @@ bool CVirtualPathDirectory::GetDirectory(const CStdString& strPath, CFileItemLis if (!GetMatchingSource(strPath, share)) return false; - DWORD progressTime = timeGetTime() + 3000L; // 3 seconds before showing progress bar + DWORD progressTime = CTimeUtils::GetTimeMS() + 3000L; // 3 seconds before showing progress bar CGUIDialogProgress* dlgProgress = NULL; unsigned int iFailures = 0; for (int i = 0; i < (int)share.vecPaths.size(); ++i) { // show the progress dialog if we have passed our time limit - if (timeGetTime() > progressTime && !dlgProgress) + if (CTimeUtils::GetTimeMS() > progressTime && !dlgProgress) { dlgProgress = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); if (dlgProgress) diff --git a/xbmc/GUIMediaWindow.cpp b/xbmc/GUIMediaWindow.cpp index 8d7ae72e6c..736fe22788 100644 --- a/xbmc/GUIMediaWindow.cpp +++ b/xbmc/GUIMediaWindow.cpp @@ -49,6 +49,7 @@ #include "Settings.h" #include "StringUtils.h" #include "LocalizeStrings.h" +#include "utils/TimeUtils.h" #define CONTROL_BTNVIEWASICONS 2 #define CONTROL_BTNSORTBY 3 @@ -535,13 +536,13 @@ bool CGUIMediaWindow::GetDirectory(const CStdString &strDirectory, CFileItemList } else { - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); if (!m_rootDir.GetDirectory(strDirectory, items)) return false; // took over a second, and not normally cached, so cache it - if (time + 1000 < timeGetTime() && items.CacheToDiscIfSlow()) + if (time + 1000 < CTimeUtils::GetTimeMS() && items.CacheToDiscIfSlow()) items.Save(); // if these items should replace the current listing, then pop it off the top diff --git a/xbmc/GUIWindowFullScreen.cpp b/xbmc/GUIWindowFullScreen.cpp index 11201e7316..fec1a2e9b8 100644 --- a/xbmc/GUIWindowFullScreen.cpp +++ b/xbmc/GUIWindowFullScreen.cpp @@ -48,6 +48,7 @@ #include "LocalizeStrings.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" #include <stdio.h> @@ -391,7 +392,7 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) #endif } m_bShowViewModeInfo = true; - m_dwShowViewModeTimeout = timeGetTime(); + m_dwShowViewModeTimeout = CTimeUtils::GetTimeMS(); } return true; break; @@ -691,7 +692,7 @@ void CGUIWindowFullScreen::RenderFullScreen() //---------------------- // ViewMode Information //---------------------- - if (m_bShowViewModeInfo && timeGetTime() - m_dwShowViewModeTimeout > 2500) + if (m_bShowViewModeInfo && CTimeUtils::GetTimeMS() - m_dwShowViewModeTimeout > 2500) { m_bShowViewModeInfo = false; } @@ -739,7 +740,7 @@ void CGUIWindowFullScreen::RenderFullScreen() if (m_timeCodeShow && m_timeCodePosition != 0) { - if ( (timeGetTime() - m_timeCodeTimeout) >= 2500) + if ( (CTimeUtils::GetTimeMS() - m_timeCodeTimeout) >= 2500) { m_timeCodeShow = false; m_timeCodePosition = 0; @@ -837,7 +838,7 @@ void CGUIWindowFullScreen::ChangetheTimeCode(int remote) if (remote >= 58 && remote <= 67) //Make sure it's only for the remote { m_timeCodeShow = true; - m_timeCodeTimeout = timeGetTime(); + m_timeCodeTimeout = CTimeUtils::GetTimeMS(); int itime = remote - 58; if (m_timeCodePosition <= 4 && m_timeCodePosition != 2) { diff --git a/xbmc/GUIWindowMusicBase.cpp b/xbmc/GUIWindowMusicBase.cpp index 39828b3047..d0eb578cf6 100644 --- a/xbmc/GUIWindowMusicBase.cpp +++ b/xbmc/GUIWindowMusicBase.cpp @@ -57,6 +57,7 @@ #include "AdvancedSettings.h" #include "GUISettings.h" #include "LocalizeStrings.h" +#include "utils/TimeUtils.h" using namespace std; using namespace XFILE; @@ -617,12 +618,12 @@ void CGUIWindowMusicBase::OnRetrieveMusicInfo(CFileItemList& items) /// \brief Retrieve tag information for \e m_vecItems void CGUIWindowMusicBase::RetrieveMusicInfo() { - DWORD dwStartTick = timeGetTime(); + DWORD dwStartTick = CTimeUtils::GetTimeMS(); OnRetrieveMusicInfo(*m_vecItems); CLog::Log(LOGDEBUG, "RetrieveMusicInfo() took %u msec", - timeGetTime() - dwStartTick); + CTimeUtils::GetTimeMS() - dwStartTick); } /// \brief Add selected list/thumb control item to playlist and start playing @@ -1278,13 +1279,13 @@ void CGUIWindowMusicBase::OnRetrieveMusicInfo(CFileItemList& items) bool bShowProgress=!g_windowManager.HasModalDialog(); bool bProgressVisible=false; - DWORD dwTick=timeGetTime(); + DWORD dwTick=CTimeUtils::GetTimeMS(); while (m_musicInfoLoader.IsLoading()) { if (bShowProgress) { // Do we have to init a progress dialog? - DWORD dwElapsed=timeGetTime()-dwTick; + DWORD dwElapsed=CTimeUtils::GetTimeMS()-dwTick; if (!bProgressVisible && dwElapsed>1500 && m_dlgProgress) { // tag loading takes more then 1.5 secs, show a progress dialog diff --git a/xbmc/GUIWindowPictures.cpp b/xbmc/GUIWindowPictures.cpp index 7045a30913..949b753113 100644 --- a/xbmc/GUIWindowPictures.cpp +++ b/xbmc/GUIWindowPictures.cpp @@ -38,6 +38,7 @@ #include "PlayList.h" #include "Settings.h" #include "GUISettings.h" +#include "utils/TimeUtils.h" #define CONTROL_BTNVIEWASICONS 2 #define CONTROL_BTNSORTBY 3 @@ -269,13 +270,13 @@ void CGUIWindowPictures::OnPrepareFileItems(CFileItemList& items) bool bShowProgress=!g_windowManager.HasModalDialog(); bool bProgressVisible=false; - DWORD dwTick=timeGetTime(); + DWORD dwTick=CTimeUtils::GetTimeMS(); while (loader.IsLoading() && m_dlgProgress && !m_dlgProgress->IsCanceled()) { if (bShowProgress) { // Do we have to init a progress dialog? - DWORD dwElapsed=timeGetTime()-dwTick; + DWORD dwElapsed=CTimeUtils::GetTimeMS()-dwTick; if (!bProgressVisible && dwElapsed>1500 && m_dlgProgress) { // tag loading takes more then 1.5 secs, show a progress dialog diff --git a/xbmc/GUIWindowPrograms.cpp b/xbmc/GUIWindowPrograms.cpp index 1862cd6aed..b805807de5 100644 --- a/xbmc/GUIWindowPrograms.cpp +++ b/xbmc/GUIWindowPrograms.cpp @@ -39,6 +39,7 @@ #include "FileItem.h" #include "Settings.h" #include "LocalizeStrings.h" +#include "utils/TimeUtils.h" using namespace XFILE; using namespace DIRECTORY; @@ -350,13 +351,13 @@ bool CGUIWindowPrograms::GetDirectory(const CStdString &strDirectory, CFileItemL // flatten any folders m_database.BeginTransaction(); - DWORD dwTick=timeGetTime(); + DWORD dwTick=CTimeUtils::GetTimeMS(); bool bProgressVisible = false; for (int i = 0; i < items.Size(); i++) { CStdString shortcutPath; CFileItemPtr item = items[i]; - if (!bProgressVisible && timeGetTime()-dwTick>1500 && m_dlgProgress) + if (!bProgressVisible && CTimeUtils::GetTimeMS()-dwTick>1500 && m_dlgProgress) { // tag loading takes more then 1.5 secs, show a progress dialog m_dlgProgress->SetHeading(189); m_dlgProgress->SetLine(0, 20120); diff --git a/xbmc/GUIWindowSlideShow.cpp b/xbmc/GUIWindowSlideShow.cpp index 42e23b31bc..a3724bca4d 100644 --- a/xbmc/GUIWindowSlideShow.cpp +++ b/xbmc/GUIWindowSlideShow.cpp @@ -41,6 +41,7 @@ #include "LocalizeStrings.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace DIRECTORY; @@ -94,12 +95,12 @@ void CBackgroundPicLoader::Process() { if (m_pCallback) { - DWORD start = timeGetTime(); + DWORD start = CTimeUtils::GetTimeMS(); 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 += timeGetTime() - start; + totalTime += CTimeUtils::GetTimeMS() - start; count++; // tell our parent bool bFullSize = ((int)texture->GetWidth() < m_maxWidth) && ((int)texture->GetHeight() < m_maxHeight); diff --git a/xbmc/LastFmManager.cpp b/xbmc/LastFmManager.cpp index b3107e7ed1..0f3cac70f3 100644 --- a/xbmc/LastFmManager.cpp +++ b/xbmc/LastFmManager.cpp @@ -46,6 +46,7 @@ #include "StringUtils.h" #include "LocalizeStrings.h" #include "tinyXML/tinyxml.h" +#include "utils/TimeUtils.h" #include <sstream> @@ -211,7 +212,7 @@ void CLastFmManager::CloseProgressDialog() bool CLastFmManager::ChangeStation(const CURL& stationUrl) { - DWORD start = timeGetTime(); + DWORD start = CTimeUtils::GetTimeMS(); CStdString strUrl; stationUrl.GetURL(strUrl); @@ -265,7 +266,7 @@ bool CLastFmManager::ChangeStation(const CURL& stationUrl) g_application.m_strPlayListFile = strUrl; //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)(timeGetTime() - start)); + CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start)); CloseProgressDialog(); return true; } @@ -275,7 +276,7 @@ bool CLastFmManager::ChangeStation(const CURL& stationUrl) bool CLastFmManager::RequestRadioTracks() { - DWORD start = timeGetTime(); + DWORD start = CTimeUtils::GetTimeMS(); CStdString url; CStdString html; url.Format("http://" + m_RadioBaseUrl + m_RadioBasePath + "/xspf.php?sk=%s&discovery=0&desktop=", m_RadioSession); @@ -415,13 +416,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)(timeGetTime() - start)); + CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start)); return iNrCachedTracks > 0; } void CLastFmManager::CacheTrackThumb(const int nrInitialTracksToAdd) { - DWORD start = timeGetTime(); + DWORD start = CTimeUtils::GetTimeMS(); CSingleLock lock(m_lockCache); int iNrCachedTracks = m_RadioTrackQueue->size(); CFileCurl http; @@ -466,7 +467,7 @@ void CLastFmManager::CacheTrackThumb(const int nrInitialTracksToAdd) item->GetMusicInfoTag()->SetLoaded(); } } - CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(timeGetTime() - start)); + CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start)); } void CLastFmManager::AddToPlaylist(const int nrTracks) @@ -504,13 +505,13 @@ void CLastFmManager::OnSongChange(CFileItem& newSong) } else { - DWORD start = timeGetTime(); + DWORD start = CTimeUtils::GetTimeMS(); ReapSongs(); MovePlaying(); Update(); SendUpdateMessage(); - CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(timeGetTime() - start)); + CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start)); } } m_CurrentSong.IsLoved = false; diff --git a/xbmc/MusicDatabase.cpp b/xbmc/MusicDatabase.cpp index e9125a7ae0..3b633f47dd 100644 --- a/xbmc/MusicDatabase.cpp +++ b/xbmc/MusicDatabase.cpp @@ -53,6 +53,7 @@ #include "StringUtils.h" #include "LocalizeStrings.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace std; using namespace AUTOPTR; @@ -1586,21 +1587,21 @@ void CMusicDatabase::EmptyCache() bool CMusicDatabase::Search(const CStdString& search, CFileItemList &items) { - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); // first grab all the artists that match SearchArtists(search, items); CLog::Log(LOGDEBUG, "%s Artist search in %i ms", - __FUNCTION__, timeGetTime() - time); time = timeGetTime(); + __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); // then albums that match SearchAlbums(search, items); CLog::Log(LOGDEBUG, "%s Album search in %i ms", - __FUNCTION__, timeGetTime() - time); time = timeGetTime(); + __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); // and finally songs SearchSongs(search, items); CLog::Log(LOGDEBUG, "%s Songs search in %i ms", - __FUNCTION__, timeGetTime() - time); time = timeGetTime(); + __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); return true; } @@ -2600,7 +2601,7 @@ bool CMusicDatabase::GetArtistsNav(const CStdString& strBaseDir, CFileItemList& if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); CStdString strSQL = "select * from artist where (idArtist IN "; @@ -2737,7 +2738,7 @@ bool CMusicDatabase::GetArtistsNav(const CStdString& strBaseDir, CFileItemList& m_pDS->next(); } - CLog::Log(LOGDEBUG,"Time to retrieve artists from dataset = %i", timeGetTime() - time); + CLog::Log(LOGDEBUG,"Time to retrieve artists from dataset = %i", CTimeUtils::GetTimeMS() - time); // cleanup m_pDS->close(); @@ -2947,7 +2948,7 @@ bool CMusicDatabase::GetSongsByWhere(const CStdString &baseDir, const CStdString try { - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); // We don't use FormatSQL here, as the WHERE clause is already formatted. CStdString strSQL = "select * from songview " + whereClause; CLog::Log(LOGDEBUG, "%s query = %s", __FUNCTION__, strSQL.c_str()); @@ -2985,7 +2986,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(), timeGetTime() - time); + CLog::Log(LOGDEBUG, "%s(%s) - took %d ms", __FUNCTION__, whereClause.c_str(), CTimeUtils::GetTimeMS() - time); return true; } catch (...) diff --git a/xbmc/MusicInfoScanner.cpp b/xbmc/MusicInfoScanner.cpp index 377601ad9e..ba0ff30222 100644 --- a/xbmc/MusicInfoScanner.cpp +++ b/xbmc/MusicInfoScanner.cpp @@ -45,6 +45,7 @@ #include "Picture.h" #include "LocalizeStrings.h" #include "StringUtils.h" +#include "utils/TimeUtils.h" #include <algorithm> @@ -71,7 +72,7 @@ void CMusicInfoScanner::Process() { try { - DWORD dwTick = timeGetTime(); + DWORD dwTick = CTimeUtils::GetTimeMS(); m_musicDatabase.Open(); @@ -150,7 +151,7 @@ void CMusicInfoScanner::Process() m_musicDatabase.Close(); CLog::Log(LOGDEBUG, "%s - Finished scan", __FUNCTION__); - dwTick = timeGetTime() - dwTick; + dwTick = CTimeUtils::GetTimeMS() - dwTick; CStdString strTmp, strTmp1; StringUtils::SecondsToTimeString(dwTick / 1000, strTmp1); strTmp.Format("My Music: Scanning for music info using worker thread, operation took %s", strTmp1); diff --git a/xbmc/PartyModeManager.cpp b/xbmc/PartyModeManager.cpp index d7e53c716a..4663b776df 100644 --- a/xbmc/PartyModeManager.cpp +++ b/xbmc/PartyModeManager.cpp @@ -31,6 +31,7 @@ #include "GUIDialogOK.h" #include "PlayList.h" #include "Settings.h" +#include "utils/TimeUtils.h" using namespace std; using namespace PLAYLIST; @@ -98,7 +99,7 @@ bool CPartyModeManager::Enable(PartyModeContext context /*= PARTYMODECONTEXT_MUS pDialog->StartModal(); ClearState(); - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); vector< pair<int,int> > songIDs; if (m_type.Equals("songs") || m_type.Equals("mixed")) { @@ -175,7 +176,7 @@ bool CPartyModeManager::Enable(PartyModeContext context /*= PARTYMODECONTEXT_MUS return false; } CLog::Log(LOGDEBUG, "%s time for song fetch: %u", - __FUNCTION__, timeGetTime() - time); + __FUNCTION__, CTimeUtils::GetTimeMS() - time); // start playing g_playlistPlayer.SetCurrentPlaylist(iPlaylist); diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp index bfd2ca39ed..8788b11e22 100644 --- a/xbmc/PlayListPlayer.cpp +++ b/xbmc/PlayListPlayer.cpp @@ -29,6 +29,7 @@ #include "GUIDialogOK.h" #include "PlayList.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace PLAYLIST; @@ -239,7 +240,7 @@ void CPlayListPlayer::Play(int iSong, bool bAutoPlay /* = false */, bool bPlayPr m_bPlaybackStarted = false; - DWORD playAttempt = timeGetTime(); + DWORD playAttempt = CTimeUtils::GetTimeMS(); if (!g_application.PlayFile(*item, bAutoPlay)) { CLog::Log(LOGERROR,"Playlist Player: skipping unplayable item: %i, path [%s]", m_iCurrentSong, item->m_strPath.c_str()); @@ -250,7 +251,7 @@ void 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) - || ((timeGetTime() - m_failedSongsStart >= (unsigned int)g_advancedSettings.m_playlistTimeout * 1000) && g_advancedSettings.m_playlistTimeout)) + || ((CTimeUtils::GetTimeMS() - m_failedSongsStart >= (unsigned int)g_advancedSettings.m_playlistTimeout * 1000) && g_advancedSettings.m_playlistTimeout)) { CLog::Log(LOGDEBUG,"Playlist Player: too many consecutive failures... aborting playback"); diff --git a/xbmc/RenderSystemDX.cpp b/xbmc/RenderSystemDX.cpp index 0573bb6463..7083883079 100644 --- a/xbmc/RenderSystemDX.cpp +++ b/xbmc/RenderSystemDX.cpp @@ -25,6 +25,7 @@ #include "Settings.h" #include "RenderSystemDX.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace std; @@ -439,7 +440,7 @@ bool CRenderSystemDX::TestRender() static DWORD lastTime = 0; static float delta = 0; - DWORD thisTime = timeGetTime(); + DWORD thisTime = CTimeUtils::GetTimeMS(); if(thisTime - lastTime > 10) { diff --git a/xbmc/SectionLoader.cpp b/xbmc/SectionLoader.cpp index 0b1e95b182..c51fa07667 100644 --- a/xbmc/SectionLoader.cpp +++ b/xbmc/SectionLoader.cpp @@ -24,6 +24,7 @@ #include "cores/DllLoader/DllLoaderContainer.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace std; @@ -108,7 +109,7 @@ void CSectionLoader::Unload(const CStdString& strSection) section.m_lReferenceCount--; if ( 0 == section.m_lReferenceCount) { - section.m_lUnloadDelayStartTick = GetTickCount(); + section.m_lUnloadDelayStartTick = CTimeUtils::GetTimeMS(); return ; } } @@ -163,7 +164,7 @@ void CSectionLoader::UnloadDLL(const CStdString &dllname) if (0 == dll.m_lReferenceCount) { if (dll.m_bDelayUnload) - dll.m_lUnloadDelayStartTick = GetTickCount(); + dll.m_lUnloadDelayStartTick = CTimeUtils::GetTimeMS(); else { CLog::Log(LOGDEBUG,"SECTION:UnloadDll(%s)", dllname.c_str()); @@ -186,7 +187,7 @@ void CSectionLoader::UnloadDelayed() while( i != g_sectionLoader.m_vecLoadedSections.end() ) { CSection& section = *i; - if( section.m_lReferenceCount == 0 && GetTickCount() - section.m_lUnloadDelayStartTick > UNLOAD_DELAY) + if( section.m_lReferenceCount == 0 && CTimeUtils::GetTimeMS() - section.m_lUnloadDelayStartTick > UNLOAD_DELAY) { CLog::Log(LOGDEBUG,"SECTION:UnloadDelayed(SECTION: %s)", section.m_strSectionName.c_str()); #ifdef HAS_SECTIONS @@ -202,7 +203,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 && GetTickCount() - dll.m_lUnloadDelayStartTick > UNLOAD_DELAY) + if (dll.m_lReferenceCount == 0 && CTimeUtils::GetTimeMS() - dll.m_lUnloadDelayStartTick > UNLOAD_DELAY) { CLog::Log(LOGDEBUG,"SECTION:UnloadDelayed(DLL: %s)", dll.m_strDllName.c_str()); diff --git a/xbmc/UPnP.cpp b/xbmc/UPnP.cpp index 443800b778..2e52a310b0 100644 --- a/xbmc/UPnP.cpp +++ b/xbmc/UPnP.cpp @@ -53,6 +53,7 @@ #include "FileItem.h" #include "GUIWindowManager.h" #include "GUIInfoManager.h" +#include "utils/TimeUtils.h" using namespace std; using namespace MUSIC_INFO; @@ -1075,7 +1076,7 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action, items.m_strPath = parent_id; if (!items.Load()) { // cache anything that takes more than a second to retrieve - DWORD time = GetTickCount() + 1000; + DWORD time = CTimeUtils::GetTimeMS() + 1000; if (parent_id.StartsWith("virtualpath://")) { CUPnPVirtualPathDirectory dir; @@ -1084,7 +1085,7 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action, CDirectory::GetDirectory((const char*)parent_id, items); } - if (items.CacheToDiscAlways() || (items.CacheToDiscIfSlow() && time < GetTickCount())) { + if (items.CacheToDiscAlways() || (items.CacheToDiscIfSlow() && time < CTimeUtils::GetTimeMS())) { items.Save(); } } diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp index 6a68d22a76..7d79f3ec9b 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp @@ -83,6 +83,7 @@ #endif #include "WindowingFactory.h" #include "LocalizeStrings.h" +#include "utils/TimeUtils.h" using namespace std; using namespace DIRECTORY; @@ -1231,7 +1232,7 @@ static const char * sub_exts[] = { ".utf", ".utf8", ".utf-8", ".sub", ".srt", ". void CUtil::CacheSubtitles(const CStdString& strMovie, CStdString& strExtensionCached, XFILE::IFileCallback *pCallback ) { - DWORD startTimer = timeGetTime(); + DWORD startTimer = CTimeUtils::GetTimeMS(); CLog::Log(LOGDEBUG,"%s: START", __FUNCTION__); // new array for commons sub dirs @@ -1343,7 +1344,7 @@ void CUtil::CacheSubtitles(const CStdString& strMovie, CStdString& strExtensionC strLookInPaths.push_back(strPath); } - DWORD nextTimer = timeGetTime(); + DWORD nextTimer = CTimeUtils::GetTimeMS(); CLog::Log(LOGDEBUG,"%s: Done (time: %i ms)", __FUNCTION__, (int)(nextTimer - startTimer)); CStdString strLExt; @@ -1418,13 +1419,13 @@ void CUtil::CacheSubtitles(const CStdString& strMovie, CStdString& strExtensionC g_directoryCache.ClearDirectory(strLookInPaths[step]); } } - CLog::Log(LOGDEBUG,"%s: Done (time: %i ms)", __FUNCTION__, (int)(timeGetTime() - nextTimer)); + CLog::Log(LOGDEBUG,"%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - nextTimer)); // construct string of added exts? for (vector<CStdString>::iterator it=vecExtensionsCached.begin(); it != vecExtensionsCached.end(); ++it) strExtensionCached += *it+" "; - CLog::Log(LOGDEBUG,"%s: END (total time: %i ms)", __FUNCTION__, (int)(timeGetTime() - startTimer)); + CLog::Log(LOGDEBUG,"%s: END (total time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - startTimer)); } bool CUtil::CacheRarSubtitles(vector<CStdString>& vecExtensionsCached, const CStdString& strRarPath, const CStdString& strCompare, const CStdString& strExtExt) @@ -2593,9 +2594,9 @@ bool CUtil::AutoDetection() if (g_guiSettings.GetBool("autodetect.onoff")) { static DWORD pingTimer = 0; - if( timeGetTime() - pingTimer < (DWORD)g_advancedSettings.m_autoDetectPingTime * 1000) + if( CTimeUtils::GetTimeMS() - pingTimer < (DWORD)g_advancedSettings.m_autoDetectPingTime * 1000) return false; - pingTimer = timeGetTime(); + pingTimer = CTimeUtils::GetTimeMS(); // send ping and request new client info if ( CUtil::AutoDetectionPing( diff --git a/xbmc/VideoDatabase.cpp b/xbmc/VideoDatabase.cpp index fe59b40b86..49147af08c 100644 --- a/xbmc/VideoDatabase.cpp +++ b/xbmc/VideoDatabase.cpp @@ -41,6 +41,7 @@ #include "Settings.h" #include "StringUtils.h" #include "LocalizeStrings.h" +#include "utils/TimeUtils.h" using namespace std; using namespace dbiplus; @@ -2764,14 +2765,14 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMovie(auto_ptr<Dataset> &pDS, bool ne CVideoInfoTag details; details.Reset(); - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); 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 += timeGetTime() - time; time = timeGetTime(); + movieTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS(); GetStreamDetailsForFileId(details.m_streamDetails, details.m_iFileId); @@ -2789,7 +2790,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMovie(auto_ptr<Dataset> &pDS, bool ne details.m_cast.push_back(info); m_pDS2->next(); } - castTime += timeGetTime() - time; time = timeGetTime(); + castTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS(); details.m_strPictureURL.Parse(); // create sets string @@ -2812,7 +2813,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForTvShow(auto_ptr<Dataset> &pDS, bool n CVideoInfoTag details; details.Reset(); - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); int idTvShow = pDS->fv(0).get_asInt(); GetDetailsFromDB(pDS, VIDEODB_ID_TV_MIN, VIDEODB_ID_TV_MAX, DbTvShowOffsets, details); @@ -2822,7 +2823,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 += timeGetTime() - time; time = timeGetTime(); + movieTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS(); if (needsCast) { @@ -2838,7 +2839,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForTvShow(auto_ptr<Dataset> &pDS, bool n details.m_cast.push_back(info); m_pDS2->next(); } - castTime += timeGetTime() - time; time = timeGetTime(); + castTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS(); details.m_strPictureURL.Parse(); } details.m_fanart.Unpack(); @@ -2850,13 +2851,13 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(auto_ptr<Dataset> &pDS, bool CVideoInfoTag details; details.Reset(); - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); 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 += timeGetTime() - time; time = timeGetTime(); + movieTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS(); details.m_strMPAARating = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_MPAA).get_asString(); details.m_strShowTitle = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_NAME).get_asString(); @@ -2892,7 +2893,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(auto_ptr<Dataset> &pDS, bool } } } - castTime += timeGetTime() - time; time = timeGetTime(); + castTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS(); m_pDS2->close(); details.m_strPictureURL.Parse(); } @@ -2904,13 +2905,13 @@ CVideoInfoTag CVideoDatabase::GetDetailsForMusicVideo(auto_ptr<Dataset> &pDS) CVideoInfoTag details; details.Reset(); - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); 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 += timeGetTime() - time; time = timeGetTime(); + movieTime += CTimeUtils::GetTimeMS() - time; time = CTimeUtils::GetTimeMS(); GetStreamDetailsForFileId(details.m_streamDetails, details.m_iFileId); @@ -3971,7 +3972,7 @@ bool CVideoDatabase::GetGenresNav(const CStdString& strBaseDir, CFileItemList& i m_pDS->close(); } -// CLog::Log(LOGDEBUG, "%s Time: %d ms", timeGetTime() - time); +// CLog::Log(LOGDEBUG, "%s Time: %d ms", CTimeUtils::GetTimeMS() - time); return true; } catch (...) @@ -4087,7 +4088,7 @@ bool CVideoDatabase::GetStudiosNav(const CStdString& strBaseDir, CFileItemList& m_pDS->close(); } -// CLog::Log(LOGDEBUG, __FUNCTION__" Time: %d ms", timeGetTime() - time); +// CLog::Log(LOGDEBUG, __FUNCTION__" Time: %d ms", CTimeUtils::GetTimeMS() - time); return true; } catch (...) @@ -4196,7 +4197,7 @@ bool CVideoDatabase::GetSetsNav(const CStdString& strBaseDir, CFileItemList& ite m_pDS->close(); } -// CLog::Log(LOGDEBUG, "%s Time: %d ms", timeGetTime() - time); +// CLog::Log(LOGDEBUG, "%s Time: %d ms", CTimeUtils::GetTimeMS() - time); return true; } catch (...) @@ -4303,7 +4304,7 @@ bool CVideoDatabase::GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileI items.SetProperty("fanart_image",items[0]->GetCachedFanart()); } -// CLog::Log(LOGDEBUG, __FUNCTION__" Time: %d ms", timeGetTime() - time); +// CLog::Log(LOGDEBUG, __FUNCTION__" Time: %d ms", CTimeUtils::GetTimeMS() - time); return true; } catch (...) @@ -4398,10 +4399,10 @@ bool CVideoDatabase::GetPeopleNav(const CStdString& strBaseDir, CFileItemList& i } // run query - unsigned int time = timeGetTime(); + unsigned int time = CTimeUtils::GetTimeMS(); if (!m_pDS->query(strSQL.c_str())) return false; CLog::Log(LOGDEBUG, "%s - query took %i ms", - __FUNCTION__, timeGetTime() - time); time = timeGetTime(); + __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); int iRowsFound = m_pDS->num_rows(); if (iRowsFound == 0) { @@ -4477,7 +4478,7 @@ bool CVideoDatabase::GetPeopleNav(const CStdString& strBaseDir, CFileItemList& i m_pDS->close(); } CLog::Log(LOGDEBUG, "%s item retrieval took %i ms", - __FUNCTION__, timeGetTime() - time); time = timeGetTime(); + __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); return true; } @@ -4850,7 +4851,7 @@ bool CVideoDatabase::GetMoviesByWhere(const CStdString& strBaseDir, const CStdSt { try { - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); movieTime = 0; castTime = 0; @@ -4870,7 +4871,7 @@ bool CVideoDatabase::GetMoviesByWhere(const CStdString& strBaseDir, const CStdSt } CLog::Log(LOGDEBUG,"Time for actual SQL query = %d", - timeGetTime() - time); time = timeGetTime(); + CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); // get data from returned rows items.Reserve(iRowsFound); @@ -4890,7 +4891,7 @@ bool CVideoDatabase::GetMoviesByWhere(const CStdString& strBaseDir, const CStdSt } CLog::Log(LOGDEBUG,"Time to retrieve movies from dataset = %d", - timeGetTime() - time); + CTimeUtils::GetTimeMS() - time); // cleanup m_pDS->close(); @@ -4924,7 +4925,7 @@ bool CVideoDatabase::GetTvShowsByWhere(const CStdString& strBaseDir, const CStdS { try { - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); movieTime = 0; if (NULL == m_pDB.get()) return false; @@ -4942,7 +4943,7 @@ bool CVideoDatabase::GetTvShowsByWhere(const CStdString& strBaseDir, const CStdS } CLog::Log(LOGDEBUG,"Time for actual SQL query = %d", - timeGetTime() - time); time = timeGetTime(); + CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); // get data from returned rows items.Reserve(iRowsFound); @@ -4971,7 +4972,7 @@ bool CVideoDatabase::GetTvShowsByWhere(const CStdString& strBaseDir, const CStdS } CLog::Log(LOGDEBUG,"Time to retrieve movies from dataset = %d", - timeGetTime() - time); + CTimeUtils::GetTimeMS() - time); if (g_guiSettings.GetBool("videolibrary.removeduplicates")) { CStdString order(where); @@ -5200,7 +5201,7 @@ bool CVideoDatabase::GetEpisodesByWhere(const CStdString& strBaseDir, const CStd { try { - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); movieTime = 0; castTime = 0; @@ -5220,7 +5221,7 @@ bool CVideoDatabase::GetEpisodesByWhere(const CStdString& strBaseDir, const CStd } CLog::Log(LOGDEBUG,"Time for actual SQL query = %d", - timeGetTime() - time); time = timeGetTime(); + CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); // get data from returned rows items.Reserve(iRowsFound); @@ -5247,7 +5248,7 @@ bool CVideoDatabase::GetEpisodesByWhere(const CStdString& strBaseDir, const CStd } CLog::Log(LOGDEBUG,"Time to retrieve movies from dataset = %d", - timeGetTime() - time); + CTimeUtils::GetTimeMS() - time); // cleanup m_pDS->close(); @@ -5947,7 +5948,7 @@ bool CVideoDatabase::GetMusicVideosByWhere(const CStdString &baseDir, const CStd { try { - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); movieTime = 0; castTime = 0; @@ -5961,7 +5962,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__, timeGetTime() - time); time = timeGetTime(); + CLog::Log(LOGDEBUG, "%s time for actual SQL query = %d", __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); int iRowsFound = m_pDS->num_rows(); if (iRowsFound == 0) @@ -5990,7 +5991,7 @@ bool CVideoDatabase::GetMusicVideosByWhere(const CStdString &baseDir, const CStd m_pDS->next(); } - CLog::Log(LOGDEBUG, "%s time to retrieve from dataset = %d", __FUNCTION__, timeGetTime() - time); time = timeGetTime(); + CLog::Log(LOGDEBUG, "%s time to retrieve from dataset = %d", __FUNCTION__, CTimeUtils::GetTimeMS() - time); time = CTimeUtils::GetTimeMS(); // cleanup m_pDS->close(); diff --git a/xbmc/VideoInfoScanner.cpp b/xbmc/VideoInfoScanner.cpp index 9ac5c821e0..51a86371e3 100644 --- a/xbmc/VideoInfoScanner.cpp +++ b/xbmc/VideoInfoScanner.cpp @@ -38,6 +38,7 @@ #include "Settings.h" #include "StringUtils.h" #include "LocalizeStrings.h" +#include "utils/TimeUtils.h" using namespace std; using namespace DIRECTORY; @@ -64,7 +65,7 @@ namespace VIDEO { try { - DWORD dwTick = timeGetTime(); + DWORD dwTick = CTimeUtils::GetTimeMS(); m_database.Open(); @@ -117,7 +118,7 @@ namespace VIDEO m_database.Close(); CLog::Log(LOGDEBUG, "%s - Finished scan", __FUNCTION__); - dwTick = timeGetTime() - dwTick; + dwTick = CTimeUtils::GetTimeMS() - dwTick; CStdString strTmp, strTmp1; StringUtils::SecondsToTimeString(dwTick / 1000, strTmp1); strTmp.Format("My Videos: Scanning for video info using worker thread, operation took %s", strTmp1); diff --git a/xbmc/XBInputEx.cpp b/xbmc/XBInputEx.cpp index fbf5353009..b9444e687c 100644 --- a/xbmc/XBInputEx.cpp +++ b/xbmc/XBInputEx.cpp @@ -6,6 +6,7 @@ #include <stdio.h> #include "XBInputEx.h" #include "Settings.h" +#include "utils/TimeUtils.h" //#define REMOTE_DEBUG 1 @@ -182,7 +183,7 @@ VOID XBInput_GetInput( XBIR_REMOTE* pIR_Remote) g_InputStatesEx[i].IR_Remote.region, g_InputStatesEx[i].IR_Remote.wButtons, g_InputStatesEx[i].IR_Remote.firstEvent, - g_eventsSinceFirstEvent[i], timeGetTime()); + g_eventsSinceFirstEvent[i], CTimeUtils::GetTimeMS()); #endif bool bSendMessage = true; diff --git a/xbmc/cdrip/CDDARipper.cpp b/xbmc/cdrip/CDDARipper.cpp index c3aa90211e..64701a380f 100644 --- a/xbmc/cdrip/CDDARipper.cpp +++ b/xbmc/cdrip/CDDARipper.cpp @@ -44,6 +44,7 @@ #include "MediaManager.h" #include "LocalizeStrings.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace std; using namespace XFILE; @@ -389,7 +390,7 @@ bool CCDDARipper::RipCD() // construct filename CUtil::AddFileToFolder(strDirectory, track, strFile); - DWORD dwTick = timeGetTime(); + DWORD dwTick = CTimeUtils::GetTimeMS(); // don't rip non cdda items if (item->m_strPath.Find(".cdda") < 0) @@ -398,7 +399,7 @@ bool CCDDARipper::RipCD() // return false if Rip returned false (this means an error or the user cancelled if (!Rip(item->m_strPath, strFile.c_str(), *item->GetMusicInfoTag())) return false; - dwTick = timeGetTime() - dwTick; + dwTick = CTimeUtils::GetTimeMS() - dwTick; CStdString strTmp; StringUtils::SecondsToTimeString(dwTick / 1000, strTmp); CLog::Log(LOGINFO, "Ripping Track %d took %s", iTrack, strTmp.c_str()); diff --git a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp index 2c6649059b..792ad4af96 100644 --- a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp +++ b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp @@ -25,6 +25,7 @@ #include "Settings.h" #include "utils/Atomics.h" #include "utils/log.h" +#include "utils/TimeUtils.h" ///////////////////////////////////////////////////////////////////////////////// // CAtomicAllocator: Wrapper class for lf_heap. @@ -242,7 +243,7 @@ void CCoreAudioPerformance::ReportData(UInt32 bytesIn, UInt32 bytesOut) return; // Perform watchdog funtions - UInt32 time = timeGetTime(); + UInt32 time = CTimeUtils::GetTimeMS(); 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 477efb729c..02b5509c0e 100644 --- a/xbmc/cores/AudioRenderers/NullDirectSound.cpp +++ b/xbmc/cores/AudioRenderers/NullDirectSound.cpp @@ -23,6 +23,7 @@ #include "AudioContext.h" #include "Application.h" #include "utils/log.h" +#include "utils/TimeUtils.h" #define BUFFER CHUNKLEN * 20 #define CHUNKLEN 512 @@ -54,7 +55,7 @@ bool CNullDirectSound::Initialize(IAudioCallback* pCallback, int iChannels, unsi m_timePerPacket = 1.0f / (float)(iChannels*(uiBitsPerSample/8) * uiSamplesPerSec); m_packetsSent = 0; m_paused = 0; - m_lastUpdate = timeGetTime(); + m_lastUpdate = CTimeUtils::GetTimeMS(); return true; } @@ -74,7 +75,7 @@ bool CNullDirectSound::Deinitialize() void CNullDirectSound::Flush() { - m_lastUpdate = timeGetTime(); + m_lastUpdate = CTimeUtils::GetTimeMS(); m_packetsSent = 0; } @@ -185,7 +186,7 @@ void CNullDirectSound::SwitchChannels(int iAudioStream, bool bAudioOnAllSpeakers void CNullDirectSound::Update() { - long currentTime = timeGetTime(); + long currentTime = CTimeUtils::GetTimeMS(); long deltaTime = (currentTime - m_lastUpdate); if (m_paused) diff --git a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp index f87aebf212..9687044415 100644 --- a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp +++ b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp @@ -26,6 +26,7 @@ #include <Mmreg.h> #include "SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" #pragma comment(lib, "dxguid.lib") @@ -170,7 +171,7 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, int iChannels, uns m_bIsAllocated = true; m_BufferOffset = 0; m_CacheLen = 0; - m_LastCacheCheck = timeGetTime(); + m_LastCacheCheck = CTimeUtils::GetTimeMS(); return m_bIsAllocated; } @@ -327,7 +328,7 @@ void CWin32DirectSound::UpdateCacheStatus() { CSingleLock lock (m_critSection); // TODO: Check to see if we may have cycled around since last time - unsigned int time = timeGetTime(); + unsigned int time = CTimeUtils::GetTimeMS(); if (time == m_LastCacheCheck) return; // Don't recalc more frequently than once/ms (that is our max resolution anyway) @@ -456,7 +457,7 @@ void CWin32DirectSound::WaitCompletion() // The drain should complete in the time occupied by the cache timeout = (DWORD)(1000 * GetDelay()); - timeout += timeGetTime(); + timeout += CTimeUtils::GetTimeMS(); silence = (unsigned char*)calloc(1,m_dwChunkSize); // Initialize 'silence' to zero... while(AddPackets(silence, m_dwChunkSize) == 0) @@ -464,7 +465,7 @@ void CWin32DirectSound::WaitCompletion() if(FAILED(m_pBuffer->GetStatus(&status)) || (status & DSBSTATUS_PLAYING) == 0) break; - if(timeout < timeGetTime()) + if(timeout < CTimeUtils::GetTimeMS()) { CLog::Log(LOGWARNING, __FUNCTION__ ": timeout adding silence to buffer"); break; @@ -477,7 +478,7 @@ void CWin32DirectSound::WaitCompletion() if(FAILED(m_pBuffer->GetStatus(&status)) || (status & DSBSTATUS_PLAYING) == 0) break; - if(timeout < timeGetTime()) + if(timeout < CTimeUtils::GetTimeMS()) { CLog::Log(LOGDEBUG, "CWin32DirectSound::WaitCompletion - timeout waiting for silence"); break; diff --git a/xbmc/cores/DummyVideoPlayer.cpp b/xbmc/cores/DummyVideoPlayer.cpp index be75bd7f47..f211a344f5 100644 --- a/xbmc/cores/DummyVideoPlayer.cpp +++ b/xbmc/cores/DummyVideoPlayer.cpp @@ -27,6 +27,7 @@ #include "AdvancedSettings.h" #include "WindowingFactory.h" #include "utils/log.h" +#include "utils/TimeUtils.h" CDummyVideoPlayer::CDummyVideoPlayer(IPlayerCallback& callback) : IPlayer(callback), @@ -73,14 +74,14 @@ bool CDummyVideoPlayer::IsPlaying() const void CDummyVideoPlayer::Process() { m_clock = 0; - m_lastTime = timeGetTime(); + m_lastTime = CTimeUtils::GetTimeMS(); m_callback.OnPlayBackStarted(); while (!m_bStop) { if (!m_paused) - m_clock += (timeGetTime() - m_lastTime)*m_speed; - m_lastTime = timeGetTime(); + m_clock += (CTimeUtils::GetTimeMS() - m_lastTime)*m_speed; + m_lastTime = CTimeUtils::GetTimeMS(); Sleep(0); g_graphicsContext.Lock(); if (g_graphicsContext.IsFullScreenVideo()) diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp index 8e6d2a7ce5..e8b38c0043 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp @@ -34,6 +34,7 @@ #include "StringUtils.h" #include "URL.h" #include "XMLUtils.h" +#include "utils/TimeUtils.h" #if defined(_WIN32) #include "Windows.h" #ifdef HAS_IRSERVERSUITE @@ -274,7 +275,7 @@ void CExternalPlayer::Process() LockSetForegroundWindow(LSFW_UNLOCK); #endif - m_playbackStartTime = timeGetTime(); + m_playbackStartTime = CTimeUtils::GetTimeMS(); BOOL ret = TRUE; #if defined(_WIN32) @@ -368,13 +369,13 @@ BOOL CExternalPlayer::ExecuteAppW32(const char* strPath, const char* strSwitches } else { - m_playbackStartTime = timeGetTime(); + m_playbackStartTime = CTimeUtils::GetTimeMS(); BOOL bIsLauncher = m_islauncher; if (m_hidexbmc && !m_islauncher) { int res = WaitForSingleObject(pi.hProcess, INFINITE); - if (timeGetTime() - m_playbackStartTime < LAUNCHER_PROCESS_TIME) + if (CTimeUtils::GetTimeMS() - m_playbackStartTime < LAUNCHER_PROCESS_TIME) { CLog::Log(LOGNOTICE, "%s: External player process ended too quickly, assuming it's a launcher process", __FUNCTION__); bIsLauncher = true; @@ -459,7 +460,7 @@ BOOL CExternalPlayer::ExecuteAppW32(const char* strPath, const char* strSwitches void CALLBACK CExternalPlayer::AppFinished(void* closure, BOOLEAN TimerOrWaitFired) { CExternalPlayer *player = (CExternalPlayer *)closure; - if (timeGetTime() - player->m_playbackStartTime < LAUNCHER_PROCESS_TIME) + if (CTimeUtils::GetTimeMS() - player->m_playbackStartTime < LAUNCHER_PROCESS_TIME) { CLog::Log(LOGNOTICE, "%s: Process ran for <%dms, probably a launcher, not closing dialog", __FUNCTION__, LAUNCHER_PROCESS_TIME); } diff --git a/xbmc/cores/dlgcache.cpp b/xbmc/cores/dlgcache.cpp index 28ac5f51b3..9b11af371f 100644 --- a/xbmc/cores/dlgcache.cpp +++ b/xbmc/cores/dlgcache.cpp @@ -25,6 +25,7 @@ #include "LocalizeStrings.h" #include "utils/log.h" #include "utils/SingleLock.h" +#include "utils/TimeUtils.h" CDlgCache::CDlgCache(DWORD dwDelay, const CStdString& strHeader, const CStdString& strMsg) { @@ -41,7 +42,7 @@ CDlgCache::CDlgCache(DWORD dwDelay, const CStdString& strHeader, const CStdStrin if(dwDelay == 0) OpenDialog(); else - m_dwTimeStamp = GetTickCount() + dwDelay; + m_dwTimeStamp = CTimeUtils::GetTimeMS() + dwDelay; Create(true); } @@ -128,7 +129,7 @@ void CDlgCache::Process() { bSentCancel = true; } - else if( !m_pDlg->IsDialogRunning() && GetTickCount() > m_dwTimeStamp + else if( !m_pDlg->IsDialogRunning() && CTimeUtils::GetTimeMS() > m_dwTimeStamp && !g_windowManager.IsWindowActive(WINDOW_DIALOG_YES_NO) ) OpenDialog(); } diff --git a/xbmc/cores/dvdplayer/DVDClock.cpp b/xbmc/cores/dvdplayer/DVDClock.cpp index eb68c47153..f38b5cc4ae 100644 --- a/xbmc/cores/dvdplayer/DVDClock.cpp +++ b/xbmc/cores/dvdplayer/DVDClock.cpp @@ -27,10 +27,10 @@ #include "utils/log.h" #if defined(_WIN32) -static void TimeGetTimeFrequency(LARGE_INTEGER* freq){ freq->QuadPart = 1000; } -static void TimeGetTimeCounter(LARGE_INTEGER* val) { val->QuadPart = timeGetTime();} -#define QueryPerformanceFrequency(a) TimeGetTimeFrequency(a) -#define QueryPerformanceCounter(a) TimeGetTimeCounter(a) +static void CTimeUtils::GetTimeMSFrequency(LARGE_INTEGER* freq){ freq->QuadPart = 1000; } +static void CTimeUtils::GetTimeMSCounter(LARGE_INTEGER* val) { val->QuadPart = CTimeUtils::GetTimeMS();} +#define QueryPerformanceFrequency(a) CTimeUtils::GetTimeMSFrequency(a) +#define QueryPerformanceCounter(a) CTimeUtils::GetTimeMSCounter(a) #endif LARGE_INTEGER CDVDClock::m_systemOffset; diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index 6edf95c01e..0cb3533d12 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -46,6 +46,7 @@ #include "FileSystem/File.h" #include "utils/log.h" #include "Thread.h" +#include "utils/TimeUtils.h" void CDemuxStreamAudioFFmpeg::GetStreamInfo(std::string& strInfo) { @@ -227,7 +228,7 @@ bool CDVDDemuxFFmpeg::Aborted() if(!m_timeout) return false; - if(GetTickCount() > m_timeout) + if(CTimeUtils::GetTimeMS() > m_timeout) return true; return false; @@ -284,7 +285,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) if( m_pInput->IsStreamType(DVDSTREAM_TYPE_FFMPEG) ) { - m_timeout = GetTickCount() + 10000; + m_timeout = CTimeUtils::GetTimeMS() + 10000; // special stream type that makes avformat handle file opening // allows internal ffmpeg protocols to be used @@ -634,7 +635,7 @@ DemuxPacket* CDVDDemuxFFmpeg::Read() pkt.stream_index = MAX_STREAMS; // timeout reads after 100ms - m_timeout = GetTickCount() + 20000; + m_timeout = CTimeUtils::GetTimeMS() + 20000; int result = 0; try { diff --git a/xbmc/cores/dvdplayer/DVDFileInfo.cpp b/xbmc/cores/dvdplayer/DVDFileInfo.cpp index 3a775a1f9b..e43550eae8 100644 --- a/xbmc/cores/dvdplayer/DVDFileInfo.cpp +++ b/xbmc/cores/dvdplayer/DVDFileInfo.cpp @@ -26,6 +26,7 @@ #include "Util.h" #include "FileSystem/StackDirectory.h" #include "utils/log.h" +#include "utils/TimeUtils.h" #include "DVDFileInfo.h" #include "DVDStreamInfo.h" @@ -70,7 +71,7 @@ bool CDVDFileInfo::GetFileDuration(const CStdString &path, int& duration) bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, const CStdString &strTarget, CStreamDetails *pStreamDetails) { - int nTime = timeGetTime(); + int nTime = CTimeUtils::GetTimeMS(); CDVDInputStream *pInputStream = CDVDFactoryInputStream::CreateInputStream(NULL, strPath, ""); if (!pInputStream) { @@ -238,7 +239,7 @@ bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, const CStdString &str delete pInputStream; - int nTotalTime = timeGetTime() - nTime; + int nTotalTime = CTimeUtils::GetTimeMS() - 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 6c86e41ce1..e56b437c5d 100644 --- a/xbmc/cores/dvdplayer/DVDMessage.cpp +++ b/xbmc/cores/dvdplayer/DVDMessage.cpp @@ -22,6 +22,7 @@ #include "DVDMessage.h" #include "DVDDemuxers/DVDDemuxUtils.h" #include "DVDStreamInfo.h" +#include "utils/TimeUtils.h" /** * CDVDMsgGeneralStreamChange --- GENERAL_STREAMCHANGE @@ -60,12 +61,12 @@ void CDVDMsgGeneralSynchronize::Wait(volatile bool *abort, DWORD source) InterlockedIncrement(&m_objects); - DWORD timeout = GetTickCount() + m_timeout; + DWORD timeout = CTimeUtils::GetTimeMS() + m_timeout; if (abort) - while( m_objects < GetNrOfReferences() && timeout > GetTickCount() && !(*abort)) Sleep(1); + while( m_objects < GetNrOfReferences() && timeout > CTimeUtils::GetTimeMS() && !(*abort)) Sleep(1); else - while( m_objects < GetNrOfReferences() && timeout > GetTickCount() ) Sleep(1); + while( m_objects < GetNrOfReferences() && timeout > CTimeUtils::GetTimeMS() ) Sleep(1); } /** diff --git a/xbmc/cores/dvdplayer/DVDMessageTracker.cpp b/xbmc/cores/dvdplayer/DVDMessageTracker.cpp index 423aedc37f..3d06e3785f 100644 --- a/xbmc/cores/dvdplayer/DVDMessageTracker.cpp +++ b/xbmc/cores/dvdplayer/DVDMessageTracker.cpp @@ -99,7 +99,7 @@ void CDVDMessageTracker::Process() while (!m_bStop && iter != m_messageList.end()) { CDVDMessageTrackerItem* pItem = *iter; - if ((GetTickCount() - pItem->m_time_created) > 60000) + if ((CTimeUtils::GetTimeMS() - pItem->m_time_created) > 60000) { if (!pItem->m_debug_logged) { diff --git a/xbmc/cores/dvdplayer/DVDMessageTracker.h b/xbmc/cores/dvdplayer/DVDMessageTracker.h index edbe269b82..52fc31758e 100644 --- a/xbmc/cores/dvdplayer/DVDMessageTracker.h +++ b/xbmc/cores/dvdplayer/DVDMessageTracker.h @@ -36,7 +36,7 @@ public: { m_pMsg = pMsg; m_debug_logged = false; - m_time_created = GetTickCount(); + m_time_created = CTimeUtils::GetTimeMS(); } CDVDMsg* m_pMsg; diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index e70a171b1c..452d0aec5c 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -63,6 +63,7 @@ #include "Settings.h" #include "LocalizeStrings.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace std; @@ -970,7 +971,7 @@ void CDVDPlayer::Process() { if (m_dvd.iDVDStillTime > 0) { - if (GetTickCount() >= (m_dvd.iDVDStillStartTime + m_dvd.iDVDStillTime)) + if (CTimeUtils::GetTimeMS() >= (m_dvd.iDVDStillStartTime + m_dvd.iDVDStillTime)) { m_dvd.iDVDStillTime = 0; m_dvd.iDVDStillStartTime = 0; @@ -2728,7 +2729,7 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage) else m_dvd.iDVDStillTime = 0; - m_dvd.iDVDStillStartTime = GetTickCount(); + m_dvd.iDVDStillStartTime = CTimeUtils::GetTimeMS(); /* adjust for the output delay in the video queue */ DWORD time = 0; @@ -3281,7 +3282,7 @@ void CDVDPlayer::UpdatePlayState(double timeout) { if(m_dvd.state == DVDSTATE_STILL) { - m_State.time = GetTickCount() - m_dvd.iDVDStillStartTime; + m_State.time = CTimeUtils::GetTimeMS() - 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 93b048c0bf..0fa4a73918 100644 --- a/xbmc/cores/paplayer/PAPlayer.cpp +++ b/xbmc/cores/paplayer/PAPlayer.cpp @@ -31,6 +31,7 @@ #include "Settings.h" #include "MusicInfoTag.h" #include "../AudioRenderers/AudioRendererFactory.h" +#include "../../utils/TimeUtils.h" #ifdef _LINUX #define XBMC_SAMPLE_RATE 44100 @@ -478,13 +479,13 @@ void PAPlayer::ToFFRW(int iSpeed) void PAPlayer::UpdateCacheLevel() { //check cachelevel every .5 seconds - if (m_LastCacheLevelCheck + 500 < GetTickCount()) + if (m_LastCacheLevelCheck + 500 < CTimeUtils::GetTimeMS()) { ICodec* codec = m_decoder[m_currentDecoder].GetCodec(); if (codec) { m_CacheLevel = codec->GetCacheLevel(); - m_LastCacheLevelCheck = GetTickCount(); + m_LastCacheLevelCheck = CTimeUtils::GetTimeMS(); //CLog::Log(LOGDEBUG,"Cachelevel: %i%%", m_CacheLevel); } } @@ -876,9 +877,9 @@ void PAPlayer::HandleSeeking() { if (m_SeekTime != -1) { - DWORD time = timeGetTime(); + DWORD time = CTimeUtils::GetTimeMS(); m_timeOffset = m_decoder[m_currentDecoder].Seek(m_SeekTime); - CLog::Log(LOGDEBUG, "Seek to time %f took %i ms", 0.001f * m_SeekTime, timeGetTime() - time); + CLog::Log(LOGDEBUG, "Seek to time %f took %i ms", 0.001f * m_SeekTime, CTimeUtils::GetTimeMS() - time); FlushStreams(); m_SeekTime = -1; } diff --git a/xbmc/karaoke/karaokelyricsmanager.cpp b/xbmc/karaoke/karaokelyricsmanager.cpp index 16d17f74ac..8609747d8e 100644 --- a/xbmc/karaoke/karaokelyricsmanager.cpp +++ b/xbmc/karaoke/karaokelyricsmanager.cpp @@ -22,6 +22,7 @@ #include "GUIWindowKaraokeLyrics.h" #include "utils/SingleLock.h" #include "utils/log.h" +#include "utils/TimeUtils.h" CKaraokeLyricsManager::CKaraokeLyricsManager() { @@ -127,7 +128,7 @@ void CKaraokeLyricsManager::ProcessSlow() if ( g_application.IsPlaying() ) { if ( m_karaokeSongPlaying ) - m_lastPlayedTime = timeGetTime(); + m_lastPlayedTime = CTimeUtils::GetTimeMS(); return; } @@ -136,7 +137,7 @@ void CKaraokeLyricsManager::ProcessSlow() return; // If less than 750ms passed return; we're still processing STOP events - if ( !m_lastPlayedTime || timeGetTime() - m_lastPlayedTime < 750 ) + if ( !m_lastPlayedTime || CTimeUtils::GetTimeMS() - m_lastPlayedTime < 750 ) return; m_karaokeSongPlayed = false; // so it won't popup again diff --git a/xbmc/lib/libGoAhead/XBMChttp.cpp b/xbmc/lib/libGoAhead/XBMChttp.cpp index 92413abf95..79fda2fdf5 100644 --- a/xbmc/lib/libGoAhead/XBMChttp.cpp +++ b/xbmc/lib/libGoAhead/XBMChttp.cpp @@ -46,6 +46,7 @@ #include "FileSystem/FactoryDirectory.h" #include "LocalizeStrings.h" #include "StringUtils.h" +#include "utils/TimeUtils.h" #ifdef _WIN32 extern "C" FILE *fopen_utf8(const char *_Filename, const char *_Mode); @@ -2027,9 +2028,9 @@ CStdString CXbmcHttp::GetCloseTag() CKey CXbmcHttp::GetKey() { if (repeatKeyRate!=0) - if (GetTickCount() >= MarkTime + repeatKeyRate) + if (CTimeUtils::GetTimeMS() >= MarkTime + repeatKeyRate) { - MarkTime=GetTickCount(); + MarkTime=CTimeUtils::GetTimeMS(); key=lastKey; } return key; diff --git a/xbmc/lib/libRTMP/rtmp.cpp b/xbmc/lib/libRTMP/rtmp.cpp index e52ae95d97..db6346cb6b 100644 --- a/xbmc/lib/libRTMP/rtmp.cpp +++ b/xbmc/lib/libRTMP/rtmp.cpp @@ -36,6 +36,7 @@ #include "URL.h" #include "utils/log.h" +#include "utils/TimeUtils.h" #define RTMP_SIG_SIZE 1536 #define RTMP_LARGE_HEADER_SIZE 12 @@ -498,7 +499,7 @@ bool CRTMP::SendCheckBW() packet.m_nChannel = 0x03; // control channel (invoke) packet.m_headerType = RTMP_PACKET_SIZE_LARGE; packet.m_packetType = 0x14; // INVOKE - packet.m_nInfoField1 = timeGetTime(); + packet.m_nInfoField1 = CTimeUtils::GetTimeMS(); packet.AllocPacket(256); // should be enough char *enc = packet.m_body; @@ -593,7 +594,7 @@ bool CRTMP::SendPing(short nType, unsigned int nObject, unsigned int nTime) packet.m_nChannel = 0x02; // control channel (ping) packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; packet.m_packetType = 0x04; // ping - packet.m_nInfoField1 = timeGetTime(); + packet.m_nInfoField1 = CTimeUtils::GetTimeMS(); int nSize = (nType==0x03?10:6); // type 3 is the buffer time and requires all 3 parameters. all in all 10 bytes. packet.AllocPacket(nSize); @@ -1014,7 +1015,7 @@ bool CRTMP::HandShake() char serversig[RTMP_SIG_SIZE]; clientsig[0] = 0x3; - DWORD uptime = htonl(timeGetTime()); + DWORD uptime = htonl(CTimeUtils::GetTimeMS()); memcpy(clientsig + 1, &uptime, sizeof(DWORD)); memset(clientsig + 5, 0, 4); diff --git a/xbmc/linux/XLCDproc.cpp b/xbmc/linux/XLCDproc.cpp index 1d72755c11..83047eb03f 100644 --- a/xbmc/linux/XLCDproc.cpp +++ b/xbmc/linux/XLCDproc.cpp @@ -22,6 +22,7 @@ #include "PlatformInclude.h" #include "XLCDproc.h" #include "../utils/log.h" +#include "..utils/TimeUtils.h" #include "AdvancedSettings.h" #include "GUISettings.h" @@ -50,7 +51,7 @@ void XLCDproc::Initialize() return ;//nothing to do // don't try to initialize too often - int now = timeGetTime(); + int now = CTimeUtils::GetTimeMS(); if (!m_used || now < m_lastInitAttempt + m_initRetryInterval) return; m_lastInitAttempt = now; diff --git a/xbmc/linux/XSyncUtils.cpp b/xbmc/linux/XSyncUtils.cpp index ccecf773ec..cfad28cfa5 100644 --- a/xbmc/linux/XSyncUtils.cpp +++ b/xbmc/linux/XSyncUtils.cpp @@ -43,6 +43,7 @@ using namespace std; #include "../utils/log.h" +#include "../utils/TimeUtils.h" static SDL_mutex *g_mutex = SDL_CreateMutex(); @@ -282,7 +283,7 @@ DWORD WINAPI WaitForMultipleObjects( DWORD nCount, HANDLE* lpHandles, BOOL bWait return dwRet; BOOL bWaitEnded = FALSE; - DWORD dwStartTime = GetTickCount(); + DWORD dwStartTime = CTimeUtils::GetTimeMS(); BOOL *bDone = new BOOL[nCount]; CXHandle* multi = CreateEvent(NULL, FALSE, FALSE, NULL); @@ -325,7 +326,7 @@ DWORD WINAPI WaitForMultipleObjects( DWORD nCount, HANDLE* lpHandles, BOOL bWait if (bWaitEnded) break; - DWORD dwElapsed = GetTickCount() - dwStartTime; + DWORD dwElapsed = CTimeUtils::GetTimeMS() - dwStartTime; if (dwMilliseconds != INFINITE && dwElapsed >= dwMilliseconds) { dwRet = WAIT_TIMEOUT; bWaitEnded = TRUE; diff --git a/xbmc/linux/XTimeUtils.cpp b/xbmc/linux/XTimeUtils.cpp index 378bd16a5d..5586d879bd 100644 --- a/xbmc/linux/XTimeUtils.cpp +++ b/xbmc/linux/XTimeUtils.cpp @@ -43,55 +43,6 @@ #ifdef _LINUX -DWORD timeGetTime(void) -{ - // best replacement for windows timeGetTime - // 1st call sets start_mstime, subsequent are the diff - // between start_mstime and now_mstime to match SDL_GetTick behavior - // of previous usage. We might want to change this as timeGetTime is - // time (ms) since system startup. -#if defined(__APPLE__) - static long double cv; - static uint64_t start_time = 0; - uint64_t now_time; - - now_time = mach_absolute_time(); - - if (start_time == 0) - { - mach_timebase_info_data_t tbinfo; - - mach_timebase_info(&tbinfo); - cv = ((long double) tbinfo.numer) / ((long double) tbinfo.denom); - start_time = now_time; - } - - return( (now_time - start_time) * cv / 1000000.0); -#else - static uint64_t start_mstime = 0; - uint64_t now_mstime; - struct timespec ts; - - // we do it this way in case clock_gettime does not exist (osx) -#if _POSIX_TIMERS > 0 - clock_gettime(CLOCK_MONOTONIC, &ts); -#else - struct timeval tv; - gettimeofday(&tv, NULL); - ts.tv_sec = tv.tv_sec; - ts.tv_nsec = tv.tv_usec * 1000; -#endif - - now_mstime = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000); - if (start_mstime == 0) - { - start_mstime = now_mstime; - } - - return(now_mstime - start_mstime); -#endif -} - void WINAPI Sleep(DWORD dwMilliSeconds) { struct timespec req; @@ -121,55 +72,6 @@ VOID GetLocalTime(LPSYSTEMTIME sysTime) g_timezone.m_IsDST = now.tm_isdst; } -DWORD GetTickCount(void) -{ - // best replacement for windows GetTickCount - // 1st call sets start_mstime, subsequent are the diff - // between start_mstime and now_mstime to match SDL_GetTick behavior - // of previous usage. We might want to change this as GetTickCount is - // time (ms) since system startup. -#if defined(__APPLE__) - static long double cv; - static uint64_t start_time = 0; - uint64_t now_time; - - now_time = mach_absolute_time(); - - if (start_time == 0) - { - mach_timebase_info_data_t tbinfo; - - mach_timebase_info(&tbinfo); - cv = ((long double) tbinfo.numer) / ((long double) tbinfo.denom); - start_time = now_time; - } - - return( (now_time - start_time) * cv / 1000000.0); -#else - static uint64_t start_mstime = 0; - uint64_t now_mstime; - struct timespec ts; - - // we do it this way in case clock_gettime does not exist (osx) -#if _POSIX_TIMERS > 0 - clock_gettime(CLOCK_MONOTONIC, &ts); -#else - struct timeval tv; - gettimeofday(&tv, NULL); - ts.tv_sec = tv.tv_sec; - ts.tv_nsec = tv.tv_usec * 1000; -#endif - - now_mstime = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000); - if (start_mstime == 0) - { - start_mstime = now_mstime; - } - - return(now_mstime - start_mstime); -#endif -} - BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount) { if (lpPerformanceCount == NULL) return false; diff --git a/xbmc/linux/XTimeUtils.h b/xbmc/linux/XTimeUtils.h index 2d4d1053a0..cf3a8a63d5 100644 --- a/xbmc/linux/XTimeUtils.h +++ b/xbmc/linux/XTimeUtils.h @@ -26,8 +26,6 @@ VOID GetLocalTime(LPSYSTEMTIME); -DWORD GetTickCount(void); - BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount); BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency); @@ -43,9 +41,5 @@ VOID GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime); BOOL FileTimeToTimeT(const FILETIME* lpLocalFileTime, time_t *pTimeT); BOOL TimeTToFileTime(time_t timeT, FILETIME* lpLocalFileTime); -// Time -DWORD timeGetTime(VOID); - - #endif diff --git a/xbmc/osx/WinSystemOSX.mm b/xbmc/osx/WinSystemOSX.mm index feb70c5b9f..cd709ad54a 100644 --- a/xbmc/osx/WinSystemOSX.mm +++ b/xbmc/osx/WinSystemOSX.mm @@ -357,8 +357,10 @@ bool CWinSystemOSX::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl [mainWindow setBackgroundColor:[NSColor blackColor]]; [mainWindow makeKeyAndOrderFront:nil]; - [mainWindow setLevel:NSNormalWindowLevel]; // make our window the same level as the rest to enable cmd+tab switching - //[mainWindow setLevel:CGShieldingWindowLevel()]; // this will make our window topmost and hide all system messages + // make our window the same level as the rest to enable cmd+tab switching + [mainWindow setLevel:NSNormalWindowLevel]; + // this will make our window topmost and hide all system messages + //[mainWindow setLevel:CGShieldingWindowLevel()]; // ...and the original one beneath it and on the same screen. view_size = [lastView frame].size; diff --git a/xbmc/utils/AsyncFileCopy.cpp b/xbmc/utils/AsyncFileCopy.cpp index 4291f7954a..2534528cba 100644 --- a/xbmc/utils/AsyncFileCopy.cpp +++ b/xbmc/utils/AsyncFileCopy.cpp @@ -23,6 +23,7 @@ #include "GUIDialogProgress.h"
#include "GUIWindowManager.h"
#include "log.h"
+#include "utils/TimeUtils.h"
CAsyncFileCopy::CAsyncFileCopy()
{
@@ -57,14 +58,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);
- DWORD time = timeGetTime();
+ DWORD time = CTimeUtils::GetTimeMS();
while (m_running)
{
m_event.WaitMSec(1000 / 30);
if (!m_running)
break;
// start the dialog up as needed
- if (dlg && !dlg->IsDialogRunning() && timeGetTime() > time + 500) // wait 0.5 seconds before starting dialog
+ if (dlg && !dlg->IsDialogRunning() && CTimeUtils::GetTimeMS() > time + 500) // wait 0.5 seconds before starting dialog
{
dlg->SetHeading(heading);
dlg->SetLine(0, fromStripped);
diff --git a/xbmc/utils/EventClient.cpp b/xbmc/utils/EventClient.cpp index d0ad184e06..963b81b80c 100644 --- a/xbmc/utils/EventClient.cpp +++ b/xbmc/utils/EventClient.cpp @@ -34,6 +34,7 @@ #include <queue> #include "FileSystem/File.h" #include "utils/log.h" +#include "utils/TimeUtils.h" using namespace EVENTCLIENT; using namespace EVENTPACKET; @@ -806,7 +807,7 @@ bool CEventClient::GetMousePos(float& x, float& y) bool CEventClient::CheckButtonRepeat(unsigned int &next) { - unsigned int now = timeGetTime(); + unsigned int now = CTimeUtils::GetTimeMS(); if ( next == 0 ) { diff --git a/xbmc/utils/RssReader.cpp b/xbmc/utils/RssReader.cpp index 752d7432e5..be8ed58164 100644 --- a/xbmc/utils/RssReader.cpp +++ b/xbmc/utils/RssReader.cpp @@ -34,6 +34,7 @@ #include "SystemInfo.h" #include "LocalizeStrings.h" #include "GUIRSSControl.h" +#include "utils/TimeUtils.h" using namespace std; using namespace XFILE; @@ -142,10 +143,10 @@ void CRssReader::Process() strXML = "<rss><item><title>"+g_localizeStrings.Get(15301)+"</title></item></rss>"; else { - DWORD starttime = timeGetTime(); + DWORD starttime = CTimeUtils::GetTimeMS(); while ( (!m_bStop) && (nRetries > 0) ) { - DWORD currenttimer = timeGetTime() - starttime; + DWORD currenttimer = CTimeUtils::GetTimeMS() - 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 814382fb7e..5d2cb61ee4 100644 --- a/xbmc/utils/Stopwatch.cpp +++ b/xbmc/utils/Stopwatch.cpp @@ -24,6 +24,7 @@ #if defined(_LINUX) && !defined(__APPLE__) #include <sys/sysinfo.h> #endif +#include "utils/TimeUtils.h" CStopWatch::CStopWatch() { @@ -97,6 +98,6 @@ int64_t CStopWatch::GetTicks() const QueryPerformanceCounter( &currTicks ); return currTicks.QuadPart; #else - return timeGetTime(); + return CTimeUtils::GetTimeMS(); #endif } diff --git a/xbmc/utils/SystemInfo.cpp b/xbmc/utils/SystemInfo.cpp index 030d33abe2..e9e47d2d8d 100644 --- a/xbmc/utils/SystemInfo.cpp +++ b/xbmc/utils/SystemInfo.cpp @@ -35,6 +35,7 @@ #include "Settings.h" #include "LocalizeStrings.h" #include "CPUInfo.h" +#include "utils/TimeUtils.h" CSysInfo g_sysinfo; @@ -509,12 +510,12 @@ CStdString CSysInfo::GetSystemUpTime(bool bTotalUptime) if(bTotalUptime) { //Total Uptime - iInputMinutes = g_stSettings.m_iSystemTimeTotalUp + ((int)(timeGetTime() / 60000)); + iInputMinutes = g_stSettings.m_iSystemTimeTotalUp + ((int)(CTimeUtils::GetTimeMS() / 60000)); } else { //Current UpTime - iInputMinutes = (int)(timeGetTime() / 60000); + iInputMinutes = (int)(CTimeUtils::GetTimeMS() / 60000); } SystemUpTime(iInputMinutes,iMinutes, iHours, iDays); diff --git a/xbmc/utils/Teletext.cpp b/xbmc/utils/Teletext.cpp index 611823814f..e1906473e0 100644 --- a/xbmc/utils/Teletext.cpp +++ b/xbmc/utils/Teletext.cpp @@ -30,6 +30,7 @@ #include "GUISettings.h" #include "Application.h" #include "utils/log.h" +#include "utils/TimeUtils.h" #include "FileSystem/SpecialProtocol.h" #include "Settings.h" @@ -129,16 +130,16 @@ TextPageAttr_t Text_AtrTable[] = { TXT_ColorWhite , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MSGDRM3 */ { TXT_ColorMenu1 , TXT_ColorBlue , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENUHIL0 5a Z */ { TXT_ColorWhite , TXT_ColorBlue , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENUHIL1 58 X */ - { TXT_ColorMenu2 , TXT_ColorTransp, C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENUHIL2 9b › */ - { TXT_ColorMenu2 , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU0 ab « */ - { TXT_ColorYellow , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU1 a4 ¤ */ - { TXT_ColorMenu2 , TXT_ColorTransp, C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU2 9b › */ - { TXT_ColorMenu2 , TXT_ColorMenu3 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU3 cb Ë */ - { TXT_ColorCyan , TXT_ColorMenu3 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU4 c7 Ç */ - { TXT_ColorWhite , TXT_ColorMenu3 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU5 c8 È */ - { TXT_ColorWhite , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU6 a8 ¨ */ - { TXT_ColorYellow , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_CATCHMENU0 a4 ¤ */ - { TXT_ColorWhite , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f} /* ATR_CATCHMENU1 a8 ¨ */ + { TXT_ColorMenu2 , TXT_ColorTransp, C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENUHIL2 9b õ */ + { TXT_ColorMenu2 , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU0 ab ´ */ + { TXT_ColorYellow , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU1 a4 § */ + { TXT_ColorMenu2 , TXT_ColorTransp, C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU2 9b õ */ + { TXT_ColorMenu2 , TXT_ColorMenu3 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU3 cb À */ + { TXT_ColorCyan , TXT_ColorMenu3 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU4 c7 « */ + { TXT_ColorWhite , TXT_ColorMenu3 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU5 c8 » */ + { TXT_ColorWhite , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_MENU6 a8 ® */ + { TXT_ColorYellow , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f}, /* ATR_CATCHMENU0 a4 § */ + { TXT_ColorWhite , TXT_ColorMenu1 , C_G0P, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0x3f} /* ATR_CATCHMENU1 a8 ® */ }; /* shapes */ @@ -1166,7 +1167,7 @@ void CTeletextDecoder::RenderPage() m_RenderInfo.SubtitleCache[j] = c; } c->Valid = true; - c->Timestamp = timeGetTime()/1000; + c->Timestamp = CTimeUtils::GetTimeMS()/1000; if (m_txtCache->SubPageTable[m_txtCache->Page] != 0xFF) { @@ -1206,7 +1207,7 @@ void CTeletextDecoder::RenderPage() { if (m_RenderInfo.DelayStarted) { - long now = timeGetTime()/1000; + long now = CTimeUtils::GetTimeMS()/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) @@ -1312,7 +1313,7 @@ void CTeletextDecoder::DoFlashing(int startrow) /* Flashing */ TextPageAttr_t flashattr; char flashchar; - long flashphase = timeGetTime() % 1000; + long flashphase = CTimeUtils::GetTimeMS() % 1000; int srow = startrow; int erow = 24; @@ -2676,12 +2677,12 @@ int CTeletextDecoder::RenderChar(color_t *buffer, // pointer to render buffer FillRect(buffer,xres,*pPosX + curfontwidth/2, PosY, (curfontwidth+1)/2, FontHeight, bgcolor); *pPosX += curfontwidth; return 0; - case 0xEA: /* ° */ + case 0xEA: /* ∞ */ FillRect(buffer,xres,*pPosX, PosY, curfontwidth, FontHeight, bgcolor); FillRect(buffer,xres,*pPosX, PosY, curfontwidth/2, curfontwidth/2, fgcolor); *pPosX += curfontwidth; return 0; - case 0xEB: /* ¬ */ + case 0xEB: /* ¨ */ FillRect(buffer,xres,*pPosX, PosY +1, curfontwidth, FontHeight -1, bgcolor); for (Row=0; Row < curfontwidth/2; Row++) DrawHLine(buffer,xres,*pPosX + Row, PosY + Row, curfontwidth - Row, fgcolor); diff --git a/xbmc/utils/Thread.cpp b/xbmc/utils/Thread.cpp index 2b470f999d..2fef6a1bb6 100644 --- a/xbmc/utils/Thread.cpp +++ b/xbmc/utils/Thread.cpp @@ -35,6 +35,7 @@ typedef int (*PBEGINTHREADEX_THREADFUNC)(LPVOID lpThreadParameter); #include "log.h" #include "GraphicContext.h" +#include "utils/TimeUtils.h" #ifdef __APPLE__ // @@ -264,7 +265,7 @@ void CThread::Create(bool bAutoDelete, unsigned stacksize) { throw 1; //ERROR should not b possible!!! } - m_iLastTime = GetTickCount() * 10000; + m_iLastTime = CTimeUtils::GetTimeMS() * 10000; m_iLastUsage = 0; m_fLastUsage = 0.0f; m_bAutoDelete = bAutoDelete; @@ -398,7 +399,7 @@ void CThread::Process() float CThread::GetRelativeUsage() { - unsigned __int64 iTime = GetTickCount(); + unsigned __int64 iTime = CTimeUtils::GetTimeMS(); iTime *= 10000; // convert into 100ns tics // only update every 1 second diff --git a/xbmc/utils/TimeUtils.cpp b/xbmc/utils/TimeUtils.cpp index 2164e45320..61970debc5 100644 --- a/xbmc/utils/TimeUtils.cpp +++ b/xbmc/utils/TimeUtils.cpp @@ -21,19 +21,66 @@ #include "TimeUtils.h" #ifdef _LINUX -#include "linux/XTimeUtils.h" // for timeGetTime +#include <sys/times.h> +#ifdef __APPLE__ +#include <mach/mach_time.h> +#endif #elif defined(_WIN32) -#include <windows.h> // for timeGetTime +#include <windows.h> // for CTimeUtils::GetTimeMS #endif unsigned int CTimeUtils::frameTime = 0; void CTimeUtils::UpdateFrameTime() { - frameTime = timeGetTime(); + frameTime = GetTimeMS(); } unsigned int CTimeUtils::GetFrameTime() { return frameTime; } + +unsigned int CTimeUtils::GetTimeMS() +{ + // best replacement for windows CTimeUtils::GetTimeMS + // 1st call sets start_mstime, subsequent are the diff + // between start_mstime and now_mstime to match SDL_GetTick behavior + // of previous usage. We might want to change this as CTimeUtils::GetTimeMS is + // time (ms) since system startup. +#if defined(_WIN32) + return CTimeUtils::GetTimeMS(); +#elif defined(_LINUX) +#if defined(__APPLE__) + static long double cv; + static uint64_t start_time = 0; + uint64_t now_time; + + now_time = mach_absolute_time(); + + if (start_time == 0) + { + mach_timebase_info_data_t tbinfo; + + mach_timebase_info(&tbinfo); + cv = ((long double) tbinfo.numer) / ((long double) tbinfo.denom); + start_time = now_time; + } + + return( (now_time - start_time) * cv / 1000000.0); +#else + static uint64_t start_mstime = 0; + uint64_t now_mstime; + struct timespec ts; + + now_mstime = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000); + if (start_mstime == 0) + { + start_mstime = now_mstime; + } + + return(now_mstime - start_mstime); +#endif +#endif +} + diff --git a/xbmc/utils/TimeUtils.h b/xbmc/utils/TimeUtils.h index 6314ee9b26..3800f1fb89 100644 --- a/xbmc/utils/TimeUtils.h +++ b/xbmc/utils/TimeUtils.h @@ -28,6 +28,7 @@ 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(); private: static unsigned int frameTime; }; diff --git a/xbmc/utils/UdpClient.cpp b/xbmc/utils/UdpClient.cpp index 335d63331d..fdad0a5fc9 100644 --- a/xbmc/utils/UdpClient.cpp +++ b/xbmc/utils/UdpClient.cpp @@ -26,6 +26,7 @@ #include "../utils/Network.h" #include "GraphicContext.h" #include "log.h" +#include "utils/TimeUtils.h" #define UDPCLIENT_DEBUG_LEVEL LOGDEBUG @@ -194,7 +195,7 @@ void CUdpClient::Process() CStdString message = messageBuffer; CLog::Log(UDPCLIENT_DEBUG_LEVEL, "UDPCLIENT RX: %u\t\t<- '%s'", - timeGetTime(), message.c_str() ); + CTimeUtils::GetTimeMS(), 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 @@ -245,7 +246,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>", - timeGetTime(), command.binarySize ); + CTimeUtils::GetTimeMS(), command.binarySize ); do { @@ -259,7 +260,7 @@ bool CUdpClient::DispatchNextCommand() { // only perform the following if logging level at debug CLog::Log(UDPCLIENT_DEBUG_LEVEL, "UDPCLIENT TX: %u\t\t-> '%s'", - timeGetTime(), command.message.c_str() ); + CTimeUtils::GetTimeMS(), command.message.c_str() ); do { diff --git a/xbmc/utils/Weather.cpp b/xbmc/utils/Weather.cpp index 4e05a0ab4b..21ac65b13c 100644 --- a/xbmc/utils/Weather.cpp +++ b/xbmc/utils/Weather.cpp @@ -37,6 +37,7 @@ #include "LangInfo.h" #include "LocalizeStrings.h" #include "FileSystem/Directory.h" +#include "utils/TimeUtils.h" using namespace std; using namespace DIRECTORY; @@ -144,7 +145,7 @@ CWeather::CWeather(void) : CInfoLoader(30 * 60 * 1000) // 30 minutes Reset(); - srand(timeGetTime()); + srand(CTimeUtils::GetTimeMS()); } CWeather::~CWeather(void) |