forked from Mirrors/wine-wine
kernel32: Forward GetSystemTimeAsFileTime() to NtQuerySystemTime().
This relies on FILETIME and LARGE_INTEGER having the same layout. On an i7-8700 CPU @ 3.20GHz with HZ=1000 it cuts the call cost from ~18ns to ~12ns. Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>stable
parent
a94a21026d
commit
71dc2514c3
|
@ -832,7 +832,7 @@
|
||||||
@ stdcall GetSystemRegistryQuota(ptr ptr)
|
@ stdcall GetSystemRegistryQuota(ptr ptr)
|
||||||
@ stdcall GetSystemTime(ptr)
|
@ stdcall GetSystemTime(ptr)
|
||||||
@ stdcall GetSystemTimeAdjustment(ptr ptr ptr)
|
@ stdcall GetSystemTimeAdjustment(ptr ptr ptr)
|
||||||
@ stdcall GetSystemTimeAsFileTime(ptr)
|
@ stdcall GetSystemTimeAsFileTime(ptr) ntdll.NtQuerySystemTime
|
||||||
@ stdcall GetSystemTimePreciseAsFileTime(ptr)
|
@ stdcall GetSystemTimePreciseAsFileTime(ptr)
|
||||||
@ stdcall GetSystemTimes(ptr ptr ptr)
|
@ stdcall GetSystemTimes(ptr ptr ptr)
|
||||||
@ stdcall GetSystemWindowsDirectoryA(ptr long)
|
@ stdcall GetSystemWindowsDirectoryA(ptr long)
|
||||||
|
|
|
@ -773,6 +773,20 @@ static ULONGLONG get_longlong_time(FILETIME *time)
|
||||||
return uli.QuadPart;
|
return uli.QuadPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_GetSystemTimeAsFileTime(void)
|
||||||
|
{
|
||||||
|
LARGE_INTEGER t1, t2, t3;
|
||||||
|
FILETIME ft;
|
||||||
|
|
||||||
|
NtQuerySystemTime( &t1 );
|
||||||
|
GetSystemTimeAsFileTime( &ft );
|
||||||
|
NtQuerySystemTime( &t3 );
|
||||||
|
t2.QuadPart = get_longlong_time( &ft );
|
||||||
|
|
||||||
|
ok(t1.QuadPart <= t2.QuadPart, "out of order %s %s\n", wine_dbgstr_longlong(t1.QuadPart), wine_dbgstr_longlong(t2.QuadPart));
|
||||||
|
ok(t2.QuadPart <= t3.QuadPart, "out of order %s %s\n", wine_dbgstr_longlong(t2.QuadPart), wine_dbgstr_longlong(t3.QuadPart));
|
||||||
|
}
|
||||||
|
|
||||||
static void test_GetSystemTimePreciseAsFileTime(void)
|
static void test_GetSystemTimePreciseAsFileTime(void)
|
||||||
{
|
{
|
||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
|
@ -1012,6 +1026,7 @@ START_TEST(time)
|
||||||
test_FileTimeToDosDateTime();
|
test_FileTimeToDosDateTime();
|
||||||
test_GetCalendarInfo();
|
test_GetCalendarInfo();
|
||||||
test_GetDynamicTimeZoneInformation();
|
test_GetDynamicTimeZoneInformation();
|
||||||
|
test_GetSystemTimeAsFileTime();
|
||||||
test_GetSystemTimePreciseAsFileTime();
|
test_GetSystemTimePreciseAsFileTime();
|
||||||
test_GetTimeZoneInformationForYear();
|
test_GetTimeZoneInformationForYear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -750,27 +750,6 @@ BOOL WINAPI TzSpecificLocalTimeToSystemTime(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GetSystemTimeAsFileTime (KERNEL32.@)
|
|
||||||
*
|
|
||||||
* Get the current time in utc format.
|
|
||||||
*
|
|
||||||
* PARAMS
|
|
||||||
* time [out] Destination for the current utc time
|
|
||||||
*
|
|
||||||
* RETURNS
|
|
||||||
* Nothing.
|
|
||||||
*/
|
|
||||||
void WINAPI GetSystemTimeAsFileTime( FILETIME *time )
|
|
||||||
{
|
|
||||||
LARGE_INTEGER t;
|
|
||||||
|
|
||||||
NtQuerySystemTime( &t );
|
|
||||||
time->dwLowDateTime = t.u.LowPart;
|
|
||||||
time->dwHighDateTime = t.u.HighPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetSystemTimePreciseAsFileTime (KERNEL32.@)
|
* GetSystemTimePreciseAsFileTime (KERNEL32.@)
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue