user32: Reduce the minimum Set[System]Timer from 15 ms to 10 ms.

This commit is contained in:
Erich E. Hoover 2014-05-01 07:41:57 -06:00 committed by Alexandre Julliard
parent d5f1841417
commit b5bd529769
2 changed files with 18 additions and 16 deletions

View File

@ -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 ); if (proc) winproc = WINPROC_AllocProc( (WNDPROC)proc, FALSE );
/* MSDN states that the minimum timeout should be USER_TIMER_MINIMUM (10.0 ms), but testing timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM );
* indicates that the true minimum is closer to 15.6 ms. */
timeout = min( max( 15, timeout ), USER_TIMER_MAXIMUM );
SERVER_START_REQ( set_win_timer ) 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 ); if (proc) winproc = WINPROC_AllocProc( (WNDPROC)proc, FALSE );
/* MSDN states that the minimum timeout should be USER_TIMER_MINIMUM (10.0 ms), but testing timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM );
* indicates that the true minimum is closer to 15.6 ms. */
timeout = min( max( 15, timeout ), USER_TIMER_MAXIMUM );
SERVER_START_REQ( set_win_timer ) SERVER_START_REQ( set_win_timer )
{ {

View File

@ -8390,8 +8390,8 @@ static VOID CALLBACK tfunc(HWND hwnd, UINT uMsg, UINT_PTR id, DWORD dwTime)
} }
#define TIMER_ID 0x19 #define TIMER_ID 0x19
#define TIMER_COUNT_EXPECTED 64 #define TIMER_COUNT_EXPECTED 100
#define TIMER_COUNT_TOLERANCE 9 #define TIMER_COUNT_TOLERANCE 10
static int count = 0; static int count = 0;
static void CALLBACK callback_count(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) 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"); 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, /* 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 * which occurs sometimes, but most testing on the VMs indicates a minimum timeout closer to
* some measurement error between test runs we're allowing for ±8 counts (~2 ms). * 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; count = 0;
id = SetTimer(info.hWnd, TIMER_ID, 0, callback_count); id = SetTimer(info.hWnd, TIMER_ID, 0, callback_count);
@ -8452,8 +8453,9 @@ static void test_timers(void)
start = GetTickCount(); start = GetTickCount();
while (GetTickCount()-start < 1001 && GetMessageA(&msg, info.hWnd, 0, 0)) while (GetTickCount()-start < 1001 && GetMessageA(&msg, info.hWnd, 0, 0))
DispatchMessageA(&msg); DispatchMessageA(&msg);
ok(abs(count-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE ok(abs(count-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE /* xp */
|| broken(abs(count-43) < TIMER_COUNT_TOLERANCE) /* w2k3 */, || 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", "did not get expected count for minimum timeout (%d != ~%d).\n",
count, TIMER_COUNT_EXPECTED); count, TIMER_COUNT_EXPECTED);
ok(KillTimer(info.hWnd, id), "KillTimer failed\n"); ok(KillTimer(info.hWnd, id), "KillTimer failed\n");
@ -8473,7 +8475,9 @@ static void test_timers(void)
syscount++; syscount++;
DispatchMessageA(&msg); 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", "did not get expected count for minimum timeout (%d != ~%d).\n",
syscount, TIMER_COUNT_EXPECTED); syscount, TIMER_COUNT_EXPECTED);
todo_wine ok(count == 0, "did not get expected count for callback timeout (%d != 0).\n", 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); 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, /* 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 * which occurs sometimes, but most testing on the VMs indicates a minimum timeout closer to
* some measurement error between test runs we're allowing for ±8 counts (~2 ms). * 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; count = 0;
id = SetTimer(NULL, 0, 0, callback_count); id = SetTimer(NULL, 0, 0, callback_count);
@ -8516,7 +8521,8 @@ static void test_timers_no_wnd(void)
start = GetTickCount(); start = GetTickCount();
while (GetTickCount()-start < 1001 && GetMessageA(&msg, NULL, 0, 0)) while (GetTickCount()-start < 1001 && GetMessageA(&msg, NULL, 0, 0))
DispatchMessageA(&msg); 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", "did not get expected count for minimum timeout (%d != ~%d).\n",
count, TIMER_COUNT_EXPECTED); count, TIMER_COUNT_EXPECTED);
KillTimer(NULL, id); KillTimer(NULL, id);