From: Jarkko Hietaniemi Date: Tue, 16 Oct 2001 17:07:20 +0000 (+0000) Subject: Can't expect too much accuracy from a sleep of one second. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=91f02c167d3c11fb2426692750c225f29df22508;p=p5sagit%2Fp5-mst-13.2.git Can't expect too much accuracy from a sleep of one second. (I think this will also fail with high load.) p4raw-id: //depot/perl@12458 --- diff --git a/ext/Time/HiRes/HiRes.t b/ext/Time/HiRes/HiRes.t index f92cb65..a2cb206 100644 --- a/ext/Time/HiRes/HiRes.t +++ b/ext/Time/HiRes/HiRes.t @@ -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";