[PATCH 3/4] quartz/tests: Check that system clock measurements are in sequence instead of comparing absolute time.
Zebediah Figura
zfigura at codeweavers.com
Mon Jul 19 22:25:26 CDT 2021
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/quartz/tests/systemclock.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c
index f13e89abedb..fa9464429f0 100644
--- a/dlls/quartz/tests/systemclock.c
+++ b/dlls/quartz/tests/systemclock.c
@@ -24,12 +24,6 @@
static ULONGLONG (WINAPI *pGetTickCount64)(void);
-static BOOL compare_time(REFERENCE_TIME x, REFERENCE_TIME y, unsigned int max_diff)
-{
- REFERENCE_TIME diff = x > y ? x - y : y - x;
- return diff <= max_diff;
-}
-
static IReferenceClock *create_system_clock(void)
{
IReferenceClock *clock = NULL;
@@ -172,7 +166,7 @@ static void test_aggregation(void)
static void test_get_time(void)
{
IReferenceClock *clock = create_system_clock();
- REFERENCE_TIME time1, time2;
+ REFERENCE_TIME time1, ticks, time2;
HRESULT hr;
ULONG ref;
@@ -180,18 +174,21 @@ static void test_get_time(void)
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
hr = IReferenceClock_GetTime(clock, &time1);
- if (pGetTickCount64)
- time2 = pGetTickCount64() * 10000;
- else
- time2 = (REFERENCE_TIME)GetTickCount() * 10000;
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(time1 % 10000 == 0, "Expected no less than 1ms coarseness, but got time %s.\n",
wine_dbgstr_longlong(time1));
- ok(compare_time(time1, time2, 20 * 10000), "Expected about %s, got %s.\n",
- wine_dbgstr_longlong(time2), wine_dbgstr_longlong(time1));
+
+ if (pGetTickCount64)
+ ticks = pGetTickCount64() * 10000;
+ else
+ ticks = (REFERENCE_TIME)GetTickCount() * 10000;
hr = IReferenceClock_GetTime(clock, &time2);
ok(hr == (time2 == time1 ? S_FALSE : S_OK), "Got hr %#x.\n", hr);
+ ok(time2 % 10000 == 0, "Expected no less than 1ms coarseness, but got time %s.\n",
+ wine_dbgstr_longlong(time1));
+
+ ok(time2 >= ticks && ticks >= time1, "Got timestamps %I64d, %I64d, %I64d.\n", time1, ticks, time2);
Sleep(100);
hr = IReferenceClock_GetTime(clock, &time2);
--
2.32.0
More information about the wine-devel
mailing list