diff --git a/OptiScaler/Util.cpp b/OptiScaler/Util.cpp index 563b477b..bbdba8b4 100644 --- a/OptiScaler/Util.cpp +++ b/OptiScaler/Util.cpp @@ -51,6 +51,26 @@ std::optional Util::NvngxPath() return result; } +double Util::MillisecondsNow() +{ + static LARGE_INTEGER s_frequency; + static BOOL s_use_qpc = QueryPerformanceFrequency(&s_frequency); + double milliseconds = 0; + + if (s_use_qpc) + { + LARGE_INTEGER now; + QueryPerformanceCounter(&now); + milliseconds = double(1000.0 * now.QuadPart) / s_frequency.QuadPart; + } + else + { + milliseconds = double(GetTickCount64()); + } + + return milliseconds; +} + std::filesystem::path Util::ExePath() { static std::filesystem::path exe; diff --git a/OptiScaler/Util.h b/OptiScaler/Util.h index 84ab9827..bdfeebda 100644 --- a/OptiScaler/Util.h +++ b/OptiScaler/Util.h @@ -6,6 +6,8 @@ namespace Util std::filesystem::path ExePath(); std::filesystem::path DllPath(); std::optional NvngxPath(); + double MillisecondsNow(); + HWND GetProcessWindow(); };