mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 20:13:37 +00:00
msvcrt/tests: Rewrite clock() tests.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
247faa857f
commit
20a11fd6cc
|
@ -875,18 +875,18 @@ static void test__tzset(void)
|
|||
|
||||
static void test_clock(void)
|
||||
{
|
||||
static const int THRESH = 50;
|
||||
clock_t s, e;
|
||||
int i;
|
||||
static const int THRESH = 100;
|
||||
FILETIME start, cur;
|
||||
int c, expect;
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
s = clock();
|
||||
Sleep(1000);
|
||||
e = clock();
|
||||
ok(GetProcessTimes(GetCurrentProcess(), &start, &cur, &cur, &cur),
|
||||
"GetProcessTimes failed with error: %d\n", GetLastError());
|
||||
GetSystemTimeAsFileTime(&cur);
|
||||
expect = (((LONGLONG)cur.dwHighDateTime<<32)+cur.dwLowDateTime -
|
||||
((LONGLONG)start.dwHighDateTime<<32)-start.dwLowDateTime) / 10000;
|
||||
|
||||
ok(abs((e-s) - 1000) < THRESH, "clock off on loop %i: %i\n", i, e-s);
|
||||
}
|
||||
c = clock();
|
||||
ok(abs(c-expect) < THRESH, "clock() = %d, expected %d\n", c, expect);
|
||||
}
|
||||
|
||||
START_TEST(time)
|
||||
|
|
Loading…
Reference in a new issue