From: Jan Dubois Date: Thu, 22 Apr 2010 19:36:31 +0000 (-0700) Subject: time() resolution is full seconds X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b983d1f35cb13f38b3ba5ebbf83a4020f8d79c0;p=p5sagit%2Fp5-mst-13.2.git time() resolution is full seconds So any fudging in the timing needs to be at least 1 second to have any effect. Upped the total $sleep value to 4 (on Windows) to make sure at least 3 seconds have passed. Amends commit 0ebb4f0. --- diff --git a/t/op/sselect.t b/t/op/sselect.t index f4c95d4..ffb4aad 100644 --- a/t/op/sselect.t +++ b/t/op/sselect.t @@ -31,11 +31,13 @@ like ($@, qr/^Modification of a read-only value attempted/); eval {select $blank, $blank, "a", 0}; like ($@, qr/^Modification of a read-only value attempted/); -my $sleep = 3; +my($sleep,$fudge) = (3,0); # Actual sleep time on Windows may be rounded down to an integral # multiple of the system clock tick interval. Clock tick interval # is configurable, but usually about 15.625 milliseconds. -my $fudge = $^O eq "MSWin32" ? 0.1 : 0; +# time() however doesn't return fractional values, so the observed +# delay may be 1 second short. +($sleep,$fudge) = (4,1) if $^O eq "MSWin32"; my $t = time; select(undef, undef, undef, $sleep);