Can't expect too much accuracy from a sleep of one second.
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 16 Oct 2001 17:07:20 +0000 (17:07 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 16 Oct 2001 17:07:20 +0000 (17:07 +0000)
(I think this will also fail with high load.)

p4raw-id: //depot/perl@12458

ext/Time/HiRes/HiRes.t

index f92cb65..a2cb206 100644 (file)
@@ -223,7 +223,9 @@ unless (defined &Time::HiRes::setitimer
     $SIG{VTALRM} = 'DEFAULT';
 }
 
-print abs(sleep(1)                  - 1) < 0.001 ? "ok 20\n" : "not ok 20\n";
+$a = abs(sleep(1)                  - 1);
+print $a < 0.1 ? "ok 20 # $a\n" : "not ok 20 # $a\n";
 
-print abs(usleep(1000000) / 1000000 - 1) < 0.001 ? "ok 21\n" : "not ok 21\n";
+$a = abs(usleep(1000000) / 1000000 - 1);
+print $a < 0.1 ? "ok 21 # $a\n" : "not ok 21 # $a\n";