Skip to content

Commit

Permalink
GetTickCount -> GetTickCount64.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Apr 5, 2024
1 parent 7d2aa42 commit 507585c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/DSUtil/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ void CProfile::InitIni()
}

// Don't reread mpc-be.ini if the cache needs to be flushed or it was accessed recently
const DWORD tick = GetTickCount();
if (m_bIniFirstInit && (m_bIniNeedFlush || tick - m_dwIniLastAccessTick < 100)) {
m_dwIniLastAccessTick = tick;
const ULONGLONG tick = GetTickCount64();
if (m_bIniFirstInit && (m_bIniNeedFlush || tick - m_IniLastAccessTick < 100u)) {
m_IniLastAccessTick = tick;
return;
}

m_bIniFirstInit = true;
m_dwIniLastAccessTick = tick;
m_IniLastAccessTick = tick;

if (!::PathFileExistsW(m_IniPath)) {
return;
Expand Down Expand Up @@ -171,7 +171,7 @@ void CProfile::InitIni()
fpStatus = fclose(fp);
ASSERT(fpStatus == 0);

m_dwIniLastAccessTick = GetTickCount(); // update the last access tick because reading the file can take a long time
m_IniLastAccessTick = GetTickCount64(); // update the last access tick because reading the file can take a long time
}

bool CProfile::StoreSettingsTo(const SettingsLocation newLocation)
Expand Down
2 changes: 1 addition & 1 deletion src/DSUtil/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CProfile
std::map<CStringW, std::map<CStringW, CStringW, KeyCmp>, KeyCmp> m_ProfileMap;
bool m_bIniFirstInit = false;
bool m_bIniNeedFlush = false;
DWORD m_dwIniLastAccessTick = 0;
ULONGLONG m_IniLastAccessTick = 0;

public:
CProfile();
Expand Down
8 changes: 4 additions & 4 deletions src/apps/mplayerc/HistoryFile.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) 2021-2023 see Authors.txt
* (C) 2021-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand Down Expand Up @@ -33,8 +33,8 @@ FILE* CMpcLstFile::CheckOpenFileForRead(bool& valid)
return nullptr;
}

const DWORD tick = GetTickCount();
if (m_LastAccessTick && std::labs(tick - m_LastAccessTick) < 100) {
const ULONGLONG tick = GetTickCount64();
if (m_LastAccessTick && tick - m_LastAccessTick < 100u) {
valid = true;
return nullptr;
}
Expand Down Expand Up @@ -74,7 +74,7 @@ void CMpcLstFile::CloseFile(FILE*& pFile)
{
int fpStatus = fclose(pFile);
ASSERT(fpStatus == 0);
m_LastAccessTick = GetTickCount();
m_LastAccessTick = GetTickCount64();
pFile = nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions src/apps/mplayerc/HistoryFile.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) 2021-2023 see Authors.txt
* (C) 2021-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand Down Expand Up @@ -74,7 +74,7 @@ struct SessionInfo {
class CMpcLstFile
{
private:
DWORD m_LastAccessTick = 0;
ULONGLONG m_LastAccessTick = 0;

protected:
std::mutex m_Mutex;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/mplayerc/PlayerPlaylistBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ POSITION CPlaylist::Shuffle()
}
}

std::shuffle(a.begin(), a.end(), std::default_random_engine((unsigned)GetTickCount()));
std::shuffle(a.begin(), a.end(), std::default_random_engine((unsigned)GetTickCount64()));
}

return a[idx++];
Expand Down

0 comments on commit 507585c

Please sign in to comment.