summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2010-03-24 09:54:24 -0700
committerJan Dubois <jand@activestate.com>2010-04-21 23:33:47 -0700
commit0ebb4f02532851260491496174fb796b13b8b961 (patch)
treef459c60db148f9d6864c3200a6502e637e107de4 /t
parente4cfa6395eb871dc4c90fd7e873dd87438075285 (diff)
downloadperl-0ebb4f02532851260491496174fb796b13b8b961.tar.gz
Add fudge to timing checks on Windows
sleep() time on Win32 may be rounded down to multiple of the clock tick interval. http://www.nntp.perl.org/group/perl.perl5.porters/2010/03/msg157878.html
Diffstat (limited to 't')
-rw-r--r--t/op/sselect.t9
1 files changed, 7 insertions, 2 deletions
diff --git a/t/op/sselect.t b/t/op/sselect.t
index 332b7c0b89..f4c95d4578 100644
--- a/t/op/sselect.t
+++ b/t/op/sselect.t
@@ -32,12 +32,17 @@ eval {select $blank, $blank, "a", 0};
like ($@, qr/^Modification of a read-only value attempted/);
my $sleep = 3;
+# 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;
+
my $t = time;
select(undef, undef, undef, $sleep);
-ok(time-$t >= $sleep, "$sleep seconds have passed");
+ok(time-$t >= $sleep-$fudge, "$sleep seconds have passed");
my $empty = "";
vec($empty,0,1) = 0;
$t = time;
select($empty, undef, undef, $sleep);
-ok(time-$t >= $sleep, "$sleep seconds have passed");
+ok(time-$t >= $sleep-$fudge, "$sleep seconds have passed");