diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 1e93c8d3e0c..be5d995b0ba 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -4439,9 +4439,7 @@ UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc ) if (proc) winproc = WINPROC_AllocProc( (WNDPROC)proc, FALSE ); - /* MSDN states that the minimum timeout should be USER_TIMER_MINIMUM (10.0 ms), but testing - * indicates that the true minimum is closer to 15.6 ms. */ - timeout = min( max( 15, timeout ), USER_TIMER_MAXIMUM ); + timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM ); SERVER_START_REQ( set_win_timer ) { @@ -4474,9 +4472,7 @@ UINT_PTR WINAPI SetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC if (proc) winproc = WINPROC_AllocProc( (WNDPROC)proc, FALSE ); - /* MSDN states that the minimum timeout should be USER_TIMER_MINIMUM (10.0 ms), but testing - * indicates that the true minimum is closer to 15.6 ms. */ - timeout = min( max( 15, timeout ), USER_TIMER_MAXIMUM ); + timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM ); SERVER_START_REQ( set_win_timer ) { diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 64061907647..66b9c7e4173 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -8390,8 +8390,8 @@ static VOID CALLBACK tfunc(HWND hwnd, UINT uMsg, UINT_PTR id, DWORD dwTime) } #define TIMER_ID 0x19 -#define TIMER_COUNT_EXPECTED 64 -#define TIMER_COUNT_TOLERANCE 9 +#define TIMER_COUNT_EXPECTED 100 +#define TIMER_COUNT_TOLERANCE 10 static int count = 0; static void CALLBACK callback_count(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) @@ -8442,8 +8442,9 @@ static void test_timers(void) ok( KillTimer(info.hWnd, TIMER_ID), "KillTimer failed\n"); /* Check the minimum allowed timeout for a timer. MSDN indicates that it should be 10.0 ms, - * but testing indicates that the minimum timeout is actually about 15.6 ms. Since there is - * some measurement error between test runs we're allowing for ±8 counts (~2 ms). + * which occurs sometimes, but most testing on the VMs indicates a minimum timeout closer to + * 15.6 ms. Since there is some measurement error between test runs we are allowing for + * ±9 counts (~4 ms) around the expected value. */ count = 0; id = SetTimer(info.hWnd, TIMER_ID, 0, callback_count); @@ -8452,8 +8453,9 @@ static void test_timers(void) start = GetTickCount(); while (GetTickCount()-start < 1001 && GetMessageA(&msg, info.hWnd, 0, 0)) DispatchMessageA(&msg); - ok(abs(count-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE - || broken(abs(count-43) < TIMER_COUNT_TOLERANCE) /* w2k3 */, + ok(abs(count-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE /* xp */ + || broken(abs(count-64) < TIMER_COUNT_TOLERANCE) /* most common */ + || broken(abs(count-43) < TIMER_COUNT_TOLERANCE) /* w2k3, win8 */, "did not get expected count for minimum timeout (%d != ~%d).\n", count, TIMER_COUNT_EXPECTED); ok(KillTimer(info.hWnd, id), "KillTimer failed\n"); @@ -8473,7 +8475,9 @@ static void test_timers(void) syscount++; DispatchMessageA(&msg); } - ok(abs(syscount-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE, + ok(abs(syscount-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE + || broken(abs(syscount-64) < TIMER_COUNT_TOLERANCE) /* most common */ + || broken(syscount > 4000 && syscount < 12000) /* win2k3sp0 */, "did not get expected count for minimum timeout (%d != ~%d).\n", syscount, TIMER_COUNT_EXPECTED); todo_wine ok(count == 0, "did not get expected count for callback timeout (%d != 0).\n", @@ -8507,8 +8511,9 @@ static void test_timers_no_wnd(void) ok(count == 1, "killing replaced timer did not work (%i).\n", count); /* Check the minimum allowed timeout for a timer. MSDN indicates that it should be 10.0 ms, - * but testing indicates that the minimum timeout is actually about 15.6 ms. Since there is - * some measurement error between test runs we're allowing for ±8 counts (~2 ms). + * which occurs sometimes, but most testing on the VMs indicates a minimum timeout closer to + * 15.6 ms. Since there is some measurement error between test runs we are allowing for + * ±9 counts (~4 ms) around the expected value. */ count = 0; id = SetTimer(NULL, 0, 0, callback_count); @@ -8516,7 +8521,8 @@ static void test_timers_no_wnd(void) start = GetTickCount(); while (GetTickCount()-start < 1001 && GetMessageA(&msg, NULL, 0, 0)) DispatchMessageA(&msg); - ok(abs(count-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE, + ok(abs(count-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE /* xp */ + || broken(abs(count-64) < TIMER_COUNT_TOLERANCE) /* most common */, "did not get expected count for minimum timeout (%d != ~%d).\n", count, TIMER_COUNT_EXPECTED); KillTimer(NULL, id);