13 #define sleep(t) Sleep((t) * 1000)
22 gdouble elapsed1
, elapsed2
;
25 timer
= g_timer_new ();
27 elapsed1
= g_timer_elapsed (timer
, NULL
);
28 if ((elapsed1
+ 0.1) < 1.0)
29 return FAILED ("Elapsed time should be around 1s and was %f", elapsed1
);
32 elapsed1
= g_timer_elapsed (timer
, NULL
);
33 elapsed2
= g_timer_elapsed (timer
, &usec
);
34 if (fabs (elapsed1
- elapsed2
) > 0.000001)
35 return FAILED ("The elapsed times are not equal %f - %f.", elapsed1
, elapsed2
);
38 while (elapsed2
> 1000000)
41 if (fabs (usec
- elapsed2
) > 100.0)
42 return FAILED ("usecs are wrong.");
44 g_timer_destroy (timer
);
48 static Test timer_tests
[] = {
49 {"g_timer", test_timer
},
53 DEFINE_TEST_GROUP_INIT(timer_tests_init
, timer_tests
)