summaryrefslogtreecommitdiff
path: root/deps/uv/test/test-hrtime.c
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2012-06-12 17:05:49 +0200
committerBert Belder <bertbelder@gmail.com>2012-06-12 17:06:54 +0200
commitb615077bab71db73cf065d6162cae8d6cb84d8d2 (patch)
tree340f343986de77b62cc9cd4d1cb7694adb9e9c38 /deps/uv/test/test-hrtime.c
parent0385b17ce06b7c12ad3e4035477f6a0cf897580e (diff)
downloadandroid-node-v8-b615077bab71db73cf065d6162cae8d6cb84d8d2.tar.gz
android-node-v8-b615077bab71db73cf065d6162cae8d6cb84d8d2.tar.bz2
android-node-v8-b615077bab71db73cf065d6162cae8d6cb84d8d2.zip
uv: upgrade to b7e150ee
Diffstat (limited to 'deps/uv/test/test-hrtime.c')
-rw-r--r--deps/uv/test/test-hrtime.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/deps/uv/test/test-hrtime.c b/deps/uv/test/test-hrtime.c
index 566e0d2ee0..91059f03af 100644
--- a/deps/uv/test/test-hrtime.c
+++ b/deps/uv/test/test-hrtime.c
@@ -27,25 +27,28 @@
#endif
#ifndef NANOSEC
-# define NANOSEC 1000000000
+# define NANOSEC ((uint64_t) 1e9)
#endif
TEST_IMPL(hrtime) {
uint64_t a, b, diff;
-
- a = uv_hrtime();
- uv_sleep(100);
- b = uv_hrtime();
-
- diff = b - a;
-
- printf("diff = %llu\n", (unsigned long long int) diff);
-
- /* The windows Sleep() function has only a resolution of 10-20 ms. */
- /* Check that the difference between the two hrtime values is somewhat in */
- /* the range we expect it to be. */
- ASSERT(diff > (uint64_t) 80 * NANOSEC / MILLISEC);
- ASSERT(diff < (uint64_t) 120 * NANOSEC / MILLISEC);
+ int i = 100;
+ while (i > 0) {
+ a = uv_hrtime();
+ uv_sleep(45);
+ b = uv_hrtime();
+
+ diff = b - a;
+
+ /* printf("i= %d diff = %llu\n", i, (unsigned long long int) diff); */
+
+ /* The windows Sleep() function has only a resolution of 10-20 ms. */
+ /* Check that the difference between the two hrtime values is somewhat in */
+ /* the range we expect it to be. */
+ ASSERT(diff > (uint64_t) 25 * NANOSEC / MILLISEC);
+ ASSERT(diff < (uint64_t) 60 * NANOSEC / MILLISEC);
+ --i;
+ }
return 0;
}