Module: wine Branch: master Commit: 9b12068c6c8ba656e8ca768227b1a970877d4730 URL: https://source.winehq.org/git/wine.git/?a=commit;h=9b12068c6c8ba656e8ca76822...
Author: Alexandre Julliard julliard@winehq.org Date: Thu May 21 17:07:20 2020 +0200
ntdll: Use the user shared data to implement RtlQueryUnbiasedInterruptTime().
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/tests/time.c | 2 -- dlls/ntdll/time.c | 13 ++++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c index f50d4b4d70..1628af8df2 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 06854c020d..f900b55d83 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; }