diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c index f50d4b4d701..1628af8df20 100644 --- a/dlls/ntdll/tests/time.c +++ b/dlls/ntdll/tests/time.c @@ -222,8 +222,6 @@ static void test_user_shared_data_time(void) pRtlQueryUnbiasedInterruptTime(&t3); } while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */ - /* FIXME: not always in order, but should be close */ - todo_wine_if(t1 > t2 && t1 - t2 < 50 * TICKSPERMSEC) ok(t1 <= t2, "USD InterruptTime / RtlQueryUnbiasedInterruptTime are out of order %s %s\n", wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2)); ok(t2 <= t3 || broken(t2 == t3 + 82410089070) /* w864 has some weird offset on testbot */, diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c index 06854c020da..f900b55d839 100644 --- a/dlls/ntdll/time.c +++ b/dlls/ntdll/time.c @@ -47,6 +47,7 @@ #define NONAMELESSUNION #include "windef.h" #include "winternl.h" +#include "ddk/wdm.h" #include "wine/exception.h" #include "wine/debug.h" #include "ntdll_misc.h" @@ -1128,11 +1129,21 @@ NTSTATUS WINAPI NtSetSystemTime(const LARGE_INTEGER *NewTime, LARGE_INTEGER *Old */ BOOL WINAPI RtlQueryUnbiasedInterruptTime(ULONGLONG *time) { + ULONG high, low; + if (!time) { RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER ); return FALSE; } - *time = monotonic_counter(); + + do + { + high = user_shared_data->InterruptTime.High1Time; + low = user_shared_data->InterruptTime.LowPart; + } + while (high != user_shared_data->InterruptTime.High2Time); + /* FIXME: should probably subtract InterruptTimeBias */ + *time = (ULONGLONG)high << 32 | low; return TRUE; }