kernel32: Implement GetSystemTimePreciseAsFileTime.

This just falls back to doing the same as GetSystemTimeAsFileTime.
This commit is contained in:
Martin Storsjo 2015-05-19 22:20:46 +03:00 committed by Alexandre Julliard
parent b3fe7f7c1b
commit c9c5ceccb4
6 changed files with 61 additions and 2 deletions

View File

@ -14,7 +14,7 @@
@ stdcall GetSystemTime(ptr) kernel32.GetSystemTime
@ stdcall GetSystemTimeAdjustment(ptr ptr ptr) kernel32.GetSystemTimeAdjustment
@ stdcall GetSystemTimeAsFileTime(ptr) kernel32.GetSystemTimeAsFileTime
@ stub GetSystemTimePreciseAsFileTime
@ stdcall GetSystemTimePreciseAsFileTime(ptr) kernel32.GetSystemTimePreciseAsFileTime
@ stdcall GetSystemWindowsDirectoryA(ptr long) kernel32.GetSystemWindowsDirectoryA
@ stdcall GetSystemWindowsDirectoryW(ptr long) kernel32.GetSystemWindowsDirectoryW
@ stdcall GetTickCount() kernel32.GetTickCount

View File

@ -16,7 +16,7 @@
@ stdcall GetSystemTime(ptr) kernel32.GetSystemTime
@ stdcall GetSystemTimeAdjustment(ptr ptr ptr) kernel32.GetSystemTimeAdjustment
@ stdcall GetSystemTimeAsFileTime(ptr) kernel32.GetSystemTimeAsFileTime
@ stub GetSystemTimePreciseAsFileTime
@ stdcall GetSystemTimePreciseAsFileTime(ptr) kernel32.GetSystemTimePreciseAsFileTime
@ stdcall GetSystemWindowsDirectoryA(ptr long) kernel32.GetSystemWindowsDirectoryA
@ stdcall GetSystemWindowsDirectoryW(ptr long) kernel32.GetSystemWindowsDirectoryW
@ stdcall -ret64 GetTickCount64() kernel32.GetTickCount64

View File

@ -829,6 +829,7 @@
@ stdcall GetSystemTime(ptr)
@ stdcall GetSystemTimeAdjustment(ptr ptr ptr)
@ stdcall GetSystemTimeAsFileTime(ptr)
@ stdcall GetSystemTimePreciseAsFileTime(ptr)
@ stdcall GetSystemTimes(ptr ptr ptr)
@ stdcall GetSystemWindowsDirectoryA(ptr long)
@ stdcall GetSystemWindowsDirectoryW(ptr long)

View File

@ -28,6 +28,7 @@ static BOOL (WINAPI *pSystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION,
static int (WINAPI *pGetCalendarInfoA)(LCID,CALID,CALTYPE,LPSTR,int,LPDWORD);
static int (WINAPI *pGetCalendarInfoW)(LCID,CALID,CALTYPE,LPWSTR,int,LPDWORD);
static DWORD (WINAPI *pGetDynamicTimeZoneInformation)(DYNAMIC_TIME_ZONE_INFORMATION*);
static void (WINAPI *pGetSystemTimePreciseAsFileTime)(LPFILETIME);
#define SECSPERMIN 60
#define SECSPERDAY 86400
@ -761,6 +762,45 @@ static void test_GetDynamicTimeZoneInformation(void)
trace("Dyn TimeZoneKeyName %s\n", wine_dbgstr_w(dyninfo.TimeZoneKeyName));
}
static ULONGLONG get_longlong_time(FILETIME *time)
{
ULARGE_INTEGER uli;
uli.LowPart = time->dwLowDateTime;
uli.HighPart = time->dwHighDateTime;
return uli.QuadPart;
}
static void test_GetSystemTimePreciseAsFileTime(void)
{
FILETIME ft;
ULONGLONG time1, time2;
LONGLONG diff;
if (!pGetSystemTimePreciseAsFileTime)
{
win_skip("GetSystemTimePreciseAsFileTime() is not supported.\n");
return;
}
GetSystemTimeAsFileTime(&ft);
time1 = get_longlong_time(&ft);
pGetSystemTimePreciseAsFileTime(&ft);
time2 = get_longlong_time(&ft);
diff = time2 - time1;
if (diff < 0)
diff = -diff;
ok(diff < 1000000, "Difference between GetSystemTimeAsFileTime and GetSystemTimePreciseAsFileTime more than 100 ms\n");
pGetSystemTimePreciseAsFileTime(&ft);
time1 = get_longlong_time(&ft);
do {
pGetSystemTimePreciseAsFileTime(&ft);
time2 = get_longlong_time(&ft);
} while (time2 == time1);
diff = time2 - time1;
ok(diff < 10000 && diff > 0, "GetSystemTimePreciseAsFileTime incremented by more than 1 ms\n");
}
START_TEST(time)
{
HMODULE hKernel = GetModuleHandleA("kernel32");
@ -769,6 +809,7 @@ START_TEST(time)
pGetCalendarInfoA = (void *)GetProcAddress(hKernel, "GetCalendarInfoA");
pGetCalendarInfoW = (void *)GetProcAddress(hKernel, "GetCalendarInfoW");
pGetDynamicTimeZoneInformation = (void *)GetProcAddress(hKernel, "GetDynamicTimeZoneInformation");
pGetSystemTimePreciseAsFileTime = (void *)GetProcAddress(hKernel, "GetSystemTimePreciseAsFileTime");
test_conversions();
test_invalid_arg();
@ -779,4 +820,5 @@ START_TEST(time)
test_FileTimeToDosDateTime();
test_GetCalendarInfo();
test_GetDynamicTimeZoneInformation();
test_GetSystemTimePreciseAsFileTime();
}

View File

@ -548,6 +548,21 @@ VOID WINAPI GetSystemTimeAsFileTime(
}
/***********************************************************************
* GetSystemTimePreciseAsFileTime (KERNEL32.@)
*
* Get the current time in utc format, with <1 us precision.
*
* RETURNS
* Nothing.
*/
VOID WINAPI GetSystemTimePreciseAsFileTime(
LPFILETIME time) /* [out] Destination for the current utc time */
{
GetSystemTimeAsFileTime(time);
}
/*********************************************************************
* TIME_ClockTimeToFileTime (olorin@fandra.org, 20-Sep-1998)
*

View File

@ -2040,6 +2040,7 @@ WINBASEAPI BOOL WINAPI GetSystemRegistryQuota(PDWORD,PDWORD);
WINBASEAPI VOID WINAPI GetSystemTime(LPSYSTEMTIME);
WINBASEAPI BOOL WINAPI GetSystemTimeAdjustment(PDWORD,PDWORD,PBOOL);
WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME);
WINBASEAPI VOID WINAPI GetSystemTimePreciseAsFileTime(LPFILETIME);
WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryA(LPSTR,UINT);
WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryW(LPWSTR,UINT);
#define GetSystemWindowsDirectory WINELIB_NAME_AW(GetSystemWindowsDirectory)