From 76d6e86fe5d54a76358710b9418a4f4e546867ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 23 Mar 2026 10:03:12 +0800 Subject: [PATCH] Time (Windows): prefers RTL APIs --- src/common/impl/time.c | 2 +- src/common/time.h | 2 +- src/common/windows/nt.h | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/impl/time.c b/src/common/impl/time.c index 2927f9784..a991cb560 100644 --- a/src/common/impl/time.c +++ b/src/common/impl/time.c @@ -89,7 +89,7 @@ FFTimeGetAgeResult ffTimeGetAge(uint64_t birthMs, uint64_t nowMs) static void ffTimeInitQpcMultiplier(void) { LARGE_INTEGER frequency; - QueryPerformanceFrequency(&frequency); + RtlQueryPerformanceFrequency(&frequency); ffQpcMultiplier = 1000. / (double) frequency.QuadPart; } #endif diff --git a/src/common/time.h b/src/common/time.h index 998c8f58a..0156a9c72 100644 --- a/src/common/time.h +++ b/src/common/time.h @@ -18,7 +18,7 @@ static inline double ffTimeGetTick(void) //In msec #ifdef _WIN32 extern double ffQpcMultiplier; LARGE_INTEGER start; - QueryPerformanceCounter(&start); + RtlQueryPerformanceCounter(&start); return (double) start.QuadPart * ffQpcMultiplier; #elif defined(__HAIKU__) return (double) system_time() / 1000.; diff --git a/src/common/windows/nt.h b/src/common/windows/nt.h index ac586f0b4..2b1f0543d 100644 --- a/src/common/windows/nt.h +++ b/src/common/windows/nt.h @@ -1363,3 +1363,11 @@ NTSYSAPI NTSTATUS NTAPI NtUnmapViewOfSection( _In_ HANDLE ProcessHandle, _In_opt_ PVOID BaseAddress ); + +NTSYSAPI LOGICAL NTAPI RtlQueryPerformanceCounter( + _Out_ PLARGE_INTEGER PerformanceCounter +); + +NTSYSAPI LOGICAL NTAPI RtlQueryPerformanceFrequency( + _Out_ PLARGE_INTEGER PerformanceFrequency +);