diff options
author | max99x <max99x@gmail.com> | 2011-07-07 07:34:16 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-07-07 07:34:16 +0300 |
commit | d94b2423aef4593ce2b07725e992b7eb25d5f34c (patch) | |
tree | 8ea1b5f593d341cc02e202bd2eea2e777c76b49e /tests/time/src.c | |
parent | dedb83b9e15591893e1b30220c721e447518f5d9 (diff) |
Added proper clock() test; fixed inverted clock() sign.
Diffstat (limited to 'tests/time/src.c')
-rw-r--r-- | tests/time/src.c | 9 |
1 files changed, 6 insertions, 3 deletions
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]; |