sal/osl/w32/time.cxx |   20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

New commits:
commit 027752fd96ecd65a0284796d2bfc80b27fcc7a4c
Author:     Arnaud VERSINI <arnaud.vers...@libreoffice.org>
AuthorDate: Sun Jul 13 20:56:59 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jul 15 09:11:50 2025 +0200

    sal Windows : use GetSystemTimePreciseAsFileTime directly.
    
    Function available since Windows 8 according to
    
https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
    
    Change-Id: Ib4bad3a38c47143d4b08fc0225c7b6061f8ac6ef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187823
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sal/osl/w32/time.cxx b/sal/osl/w32/time.cxx
index e8b2059f70d4..373ae7aa51cd 100644
--- a/sal/osl/w32/time.cxx
+++ b/sal/osl/w32/time.cxx
@@ -32,26 +32,10 @@ sal_Bool SAL_CALL osl_getSystemTime(TimeValue* pTimeVal)
 {
     unsigned __int64 CurTime;
 
-    typedef VOID (WINAPI *GetSystemTimePreciseAsFileTime_PROC)(LPFILETIME);
-
     assert(pTimeVal != nullptr);
 
-    static GetSystemTimePreciseAsFileTime_PROC pGetSystemTimePreciseAsFileTime 
= []()
-    {
-        HMODULE hModule = GetModuleHandleW( L"Kernel32.dll" );
-        return reinterpret_cast<GetSystemTimePreciseAsFileTime_PROC>(
-                GetProcAddress(hModule, "GetSystemTimePreciseAsFileTime"));
-    }();
-
-    // use ~1 microsecond resolution if available
-    if (pGetSystemTimePreciseAsFileTime)
-        
pGetSystemTimePreciseAsFileTime(reinterpret_cast<LPFILETIME>(&CurTime));
-    else
-    {
-        SYSTEMTIME SystemTime;
-        GetSystemTime(&SystemTime);
-        SystemTimeToFileTime(&SystemTime, 
reinterpret_cast<LPFILETIME>(&CurTime));
-    }
+    // use ~1 microsecond resolution
+    GetSystemTimePreciseAsFileTime(reinterpret_cast<LPFILETIME>(&CurTime));
 
     static const unsigned __int64 OffTime = [] {
         SYSTEMTIME SystemTime;

Reply via email to