Re: Problem in ext/Time/HiRest/HiRes.t
John P. Linderman [Fri, 31 Aug 2001 08:20:35 +0000 (04:20 -0400)]
Message-Id: <200108311220.IAA54125@raptor.research.att.com>
Fixes test 14 which could fail randomly in rare cases.

p4raw-id: //depot/perl@11797

ext/Time/HiRes/HiRes.t
regcomp.c

index 95f1a08..be462e6 100644 (file)
@@ -133,10 +133,16 @@ else {
 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
index 9877658..e5afc90 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4735,7 +4735,7 @@ Perl_save_re_context(pTHX)
     SAVEVPTR(PL_reg_re);               /* from regexec.c */
     SAVEPPTR(PL_reg_ganch);            /* from regexec.c */
     SAVESPTR(PL_reg_sv);               /* from regexec.c */
-    SAVEI32(PL_reg_sv_utf8);           /* from regexec.c */
+    SAVESPTR(PL_reg_sv_utf8);          /* from regexec.c */
     SAVEVPTR(PL_reg_magic);            /* from regexec.c */
     SAVEI32(PL_reg_oldpos);                    /* from regexec.c */
     SAVEVPTR(PL_reg_oldcurpm);         /* from regexec.c */