added get milliseconds

This commit is contained in:
cdozdil
2024-09-04 22:02:51 +03:00
parent 3f042bf082
commit a771d65d2e
2 changed files with 22 additions and 0 deletions
+20
View File
@@ -51,6 +51,26 @@ std::optional<std::filesystem::path> 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;
+2
View File
@@ -6,6 +6,8 @@ namespace Util
std::filesystem::path ExePath();
std::filesystem::path DllPath();
std::optional<std::filesystem::path> NvngxPath();
double MillisecondsNow();
HWND GetProcessWindow();
};