aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-04-22 20:43:46 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-04-22 20:43:46 +0300
commit9a37f4ce7d3a36d106a04f2555f02e2e38e25ac5 (patch)
tree65813991984c62d8794a517bed72f390c4d2d1e0
parentb80d879b78243e1dddb5abffad60294e6b47d1bc (diff)
In test_time, be more relaxed about the time wait condition - thread scheduling/system contention may interfere with the wait and produce a longer wait than 2 seconds.
-rw-r--r--tests/time/src.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/time/src.c b/tests/time/src.c
index aaf2878f..d33885fe 100644
--- a/tests/time/src.c
+++ b/tests/time/src.c
@@ -96,7 +96,8 @@ int main() {
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);
+ clock_t diff = time(NULL) - start_t;
+ printf("clock(end): %d\n", diff >= 2 && diff < 30);
// Verify that ctime_r(x, buf) is equivalent to asctime_r(localtime(x), buf).
time_t t7 = time(0);