Commit 20a11fd6 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt/tests: Rewrite clock() tests.

parent 247faa85
......@@ -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;
for (i = 0; i < 10; i++)
{
s = clock();
Sleep(1000);
e = clock();
ok(abs((e-s) - 1000) < THRESH, "clock off on loop %i: %i\n", i, e-s);
}
static const int THRESH = 100;
FILETIME start, cur;
int c, expect;
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;
c = clock();
ok(abs(c-expect) < THRESH, "clock() = %d, expected %d\n", c, expect);
}
START_TEST(time)
......
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