develooper Front page | perl.perl5.porters | Postings from August 2001

Re: Problem in ext/Time/HiRest/HiRes.t

Thread Previous | Thread Next
From:
John P. Linderman
Date:
August 31, 2001 05:20
Subject:
Re: Problem in ext/Time/HiRest/HiRes.t
Message ID:
200108311220.IAA54125@raptor.research.att.com
Arthur hinted...
> Patches welcome :)

Patch follows.  It tries a few times to get all the tests to occur within
a one second interval, but will settle for looser bounds, if needed.  -- jpl

--- HiRes.t.orig	Fri Aug 31 08:04:41 2001
+++ HiRes.t	Fri Aug 31 08:11:01 2001
@@ -133,10 +133,16 @@
 if (!$have_time) {
     skip 14
 } else {
- my $t = time();
- my $tf = Time::HiRes::time();
- ok 14, (abs($tf - $t) <= 1),
-  "time $t differs from Time::HiRes::time $tf";
+ my ($t1, $tf, $t2);
+ for my $i (1 .. 9) {
+     $t1 = time();
+     $tf = Time::HiRes::time();
+     $t2 = 1 + time();
+     last if (($t2 - $t1) <= 1);
+ }
+ ok 14, (($t1 <= $tf) && ($tf <= $t2)),
+      "Time::HiRes::time $tf not bracketed by $t1 - $t2";
+
 }
 
 unless (defined &Time::HiRes::gettimeofday



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About