Commit 9b12068c authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use the user shared data to implement RtlQueryUnbiasedInterruptTime().

parent cc595304
...@@ -222,8 +222,6 @@ static void test_user_shared_data_time(void) ...@@ -222,8 +222,6 @@ static void test_user_shared_data_time(void)
pRtlQueryUnbiasedInterruptTime(&t3); pRtlQueryUnbiasedInterruptTime(&t3);
} while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */ } 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", ok(t1 <= t2, "USD InterruptTime / RtlQueryUnbiasedInterruptTime are out of order %s %s\n",
wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2)); wine_dbgstr_longlong(t1), wine_dbgstr_longlong(t2));
ok(t2 <= t3 || broken(t2 == t3 + 82410089070) /* w864 has some weird offset on testbot */, ok(t2 <= t3 || broken(t2 == t3 + 82410089070) /* w864 has some weird offset on testbot */,
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winternl.h" #include "winternl.h"
#include "ddk/wdm.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "ntdll_misc.h" #include "ntdll_misc.h"
...@@ -1128,11 +1129,21 @@ NTSTATUS WINAPI NtSetSystemTime(const LARGE_INTEGER *NewTime, LARGE_INTEGER *Old ...@@ -1128,11 +1129,21 @@ NTSTATUS WINAPI NtSetSystemTime(const LARGE_INTEGER *NewTime, LARGE_INTEGER *Old
*/ */
BOOL WINAPI RtlQueryUnbiasedInterruptTime(ULONGLONG *time) BOOL WINAPI RtlQueryUnbiasedInterruptTime(ULONGLONG *time)
{ {
ULONG high, low;
if (!time) if (!time)
{ {
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER ); RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER );
return FALSE; 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; return TRUE;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment