aboutsummaryrefslogtreecommitdiff
path: root/tests/time
diff options
context:
space:
mode:
Diffstat (limited to 'tests/time')
-rw-r--r--tests/time/src.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/time/src.c b/tests/time/src.c
index 94eb6a3f..9517b74c 100644
--- a/tests/time/src.c
+++ b/tests/time/src.c
@@ -92,10 +92,11 @@ int main() {
printf("old asctime again: %s", formatted);
// Verify that clock() advances.
+ time_t start_t = time(NULL);
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);
+ 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), buf).
time_t t7 = time(0);