diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/time/output.txt | 3 | ||||
-rw-r--r-- | tests/time/src.c | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/tests/time/output.txt b/tests/time/output.txt index ae1fde67..45b7d4bd 100644 --- a/tests/time/output.txt +++ b/tests/time/output.txt @@ -33,5 +33,6 @@ asctime: Wed Dec 25 03:22:43 2002 old asctime: Wed Dec 25 03:22:43 2002 new asctime_r: Sat Jul 2 19:33:20 2011 old asctime again: Wed Dec 25 03:22:43 2002 -clock: 0 +clock(start): 1 +clock(end): 1 ctime: 0 diff --git a/tests/time/src.c b/tests/time/src.c index 3d4da4c2..94eb6a3f 100644 --- a/tests/time/src.c +++ b/tests/time/src.c @@ -91,10 +91,13 @@ int main() { asctime_r(tm_ptr, buffer); printf("old asctime again: %s", formatted); - // Verify that clock() is initially 0 and doesn't crash. - printf("clock: %d\n", clock()); + // Verify that clock() advances. + clock_t start = clock(); + printf("clock(start): %d\n", start >= 0); + while (clock() - start < 50000); // Poor man's sleep(). + printf("clock(end): %d\n", clock() - start >= 50000); - // Verify that ctime_r(x, buf) is equivalent to asctime_r(localtime(x), buf2). + // Verify that ctime_r(x, buf) is equivalent to asctime_r(localtime(x), buf). time_t t7 = time(0); char buffer2[30]; char buffer3[30]; |