diff options
author | kripken <alonzakai@gmail.com> | 2011-07-09 10:28:19 -0700 |
---|---|---|
committer | kripken <alonzakai@gmail.com> | 2011-07-09 10:28:19 -0700 |
commit | c79828f6b89cc64cb21ebfa00454b8ce26718cf8 (patch) | |
tree | 2f7250c054c7ff46088b3877b619f5715699b66f /tests/time/src.c | |
parent | 4fe5b2b7b6d9695a81880922ee249c620880b5d2 (diff) | |
parent | 11e404d7a8c76dbc1f10e24f4cee527f36d20092 (diff) |
Merge pull request #47 from max99x/master
Emscripten.py rewrite
Diffstat (limited to 'tests/time/src.c')
-rw-r--r-- | tests/time/src.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/time/src.c b/tests/time/src.c index 3d4da4c2..9517b74c 100644 --- a/tests/time/src.c +++ b/tests/time/src.c @@ -91,10 +91,14 @@ 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. + time_t start_t = time(NULL); + clock_t start = clock(); + printf("clock(start): %d\n", start >= 0); + while (clock() - start < 2 * CLOCKS_PER_SEC); // Poor man's sleep(). + printf("clock(end): %d\n", time(NULL) - start_t == 2); - // 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]; |