From 64cc9c1c32ff80fa565521ead90346f994c3e770 Mon Sep 17 00:00:00 2001 From: "John P. Linderman" Date: Fri, 31 Aug 2001 04:20:35 -0400 Subject: [PATCH] Re: Problem in ext/Time/HiRest/HiRes.t 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 | 14 ++++++++++---- regcomp.c | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ext/Time/HiRes/HiRes.t b/ext/Time/HiRes/HiRes.t index 95f1a08..be462e6 100644 --- a/ext/Time/HiRes/HiRes.t +++ b/ext/Time/HiRes/HiRes.t @@ -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 diff --git a/regcomp.c b/regcomp.c index 9877658..e5afc90 100644 --- 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 */ -- 2.7.4