From 22149ad2867115363d728090e454e2fd3493f96a Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 29 Nov 2007 09:56:27 +0000 Subject: [PATCH] Upgrade to Time::HiRes 1.9709 p4raw-id: //depot/perl@32549 --- ext/Time/HiRes/Changes | 8 ++++ ext/Time/HiRes/HiRes.pm | 2 +- ext/Time/HiRes/HiRes.xs | 8 ++-- ext/Time/HiRes/Makefile.PL | 5 ++- ext/Time/HiRes/t/HiRes.t | 101 +++++++++++++++++++++------------------------ 5 files changed, 63 insertions(+), 61 deletions(-) diff --git a/ext/Time/HiRes/Changes b/ext/Time/HiRes/Changes index d58aa9c..6c13f24 100644 --- a/ext/Time/HiRes/Changes +++ b/ext/Time/HiRes/Changes @@ -1,5 +1,13 @@ Revision history for the Perl extension Time::HiRes. +1.9709 [2007-11-28] + - casting fixes from Robin Barker for g++ and 64bitint + - in QNX skip the itimer tests because though the API + is there, the implementation isn't, from Matt Kraai + - raise the dead man timer to 180 seconds for really + slow/busy systems + - elaborate the UTF-8 locale warning from Makefile.PL + 1.9708 [2007-10-05] - [rt.cpan.org #29747]: Build failure with perl 5.005_05 Fixed by regenerating the ppport.h using Devel::PPPort 3.13. diff --git a/ext/Time/HiRes/HiRes.pm b/ext/Time/HiRes/HiRes.pm index e100bda..b1512cf 100644 --- a/ext/Time/HiRes/HiRes.pm +++ b/ext/Time/HiRes/HiRes.pm @@ -23,7 +23,7 @@ require DynaLoader; stat ); -$VERSION = '1.9708'; +$VERSION = '1.9709'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/Time/HiRes/HiRes.xs b/ext/Time/HiRes/HiRes.xs index 731df21..25c5633 100644 --- a/ext/Time/HiRes/HiRes.xs +++ b/ext/Time/HiRes/HiRes.xs @@ -821,8 +821,8 @@ nanosleep(nsec) CODE: if (nsec < 0.0) croak("Time::HiRes::nanosleep(%"NVgf"): negative time not invented yet", nsec); - sleepfor.tv_sec = nsec / 1e9; - sleepfor.tv_nsec = nsec - ((NV)sleepfor.tv_sec) * 1e9; + sleepfor.tv_sec = (Time_t)(nsec / 1e9); + sleepfor.tv_nsec = (long)(nsec - ((NV)sleepfor.tv_sec) * 1e9); if (!nanosleep(&sleepfor, &unslept)) { RETVAL = nsec; } else { @@ -1147,8 +1147,8 @@ clock_nanosleep(clock_id, nsec, flags = 0) CODE: if (nsec < 0.0) croak("Time::HiRes::clock_nanosleep(..., %"NVgf"): negative time not invented yet", nsec); - sleepfor.tv_sec = nsec / 1e9; - sleepfor.tv_nsec = nsec - ((NV)sleepfor.tv_sec) * 1e9; + sleepfor.tv_sec = (Time_t)(nsec / 1e9); + sleepfor.tv_nsec = (long)(nsec - ((NV)sleepfor.tv_sec) * 1e9); if (!clock_nanosleep(clock_id, flags, &sleepfor, &unslept)) { RETVAL = nsec; } else { diff --git a/ext/Time/HiRes/Makefile.PL b/ext/Time/HiRes/Makefile.PL index cc725b2..15d72e8 100644 --- a/ext/Time/HiRes/Makefile.PL +++ b/ext/Time/HiRes/Makefile.PL @@ -851,12 +851,15 @@ EOM if ((exists $ENV{LC_ALL} && $ENV{LC_ALL} =~ /utf-?8/i) || (exists $ENV{LC_CTYPE} && $ENV{LC_CTYPE} =~ /utf-?8/i) || (exists $ENV{LANG} && $ENV{LANG} =~ /utf-?8/i)) { - print <new("tick"), + $oldaction) + or die "Error setting SIGALRM handler with sigaction: $!\n"; + } else { + print "# SIG tick\n"; + $SIG{ALRM} = "tick"; + } - # on VMS timers can not interrupt select. - if ($^O ne 'VMS') { - $r = [Time::HiRes::gettimeofday()]; - $i = 5; - if ($use_sigaction) { - $oldaction = new POSIX::SigAction; - printf "# sigaction tick, ALRM = %d\n", &POSIX::SIGALRM; - # Perl's deferred signals may be too wimpy to break through - # a restartable select(), so use POSIX::sigaction if available. - POSIX::sigaction(&POSIX::SIGALRM, POSIX::SigAction->new("tick"), - $oldaction) - or die "Error setting SIGALRM handler with sigaction: $!\n"; - } else { - print "# SIG tick\n"; - $SIG{ALRM} = "tick"; + while ($i > 0) + { + alarm(0.3); + select (undef, undef, undef, 3); + my $ival = Time::HiRes::tv_interval ($r); + print "# Select returned! $i $ival\n"; + print "# ", abs($ival/3 - 1), "\n"; + # Whether select() gets restarted after signals is + # implementation dependent. If it is restarted, we + # will get about 3.3 seconds: 3 from the select, 0.3 + # from the alarm. If this happens, let's just skip + # this particular test. --jhi + if (abs($ival/3.3 - 1) < $limit) { + $ok = "Skip: your select() may get restarted by your SIGALRM (or just retry test)"; + undef $not; + last; } - - while ($i > 0) - { - alarm(0.3); - select (undef, undef, undef, 3); - my $ival = Time::HiRes::tv_interval ($r); - print "# Select returned! $i $ival\n"; - print "# ", abs($ival/3 - 1), "\n"; - # Whether select() gets restarted after signals is - # implementation dependent. If it is restarted, we - # will get about 3.3 seconds: 3 from the select, 0.3 - # from the alarm. If this happens, let's just skip - # this particular test. --jhi - if (abs($ival/3.3 - 1) < $limit) { - $ok = - "Skip: your select() may get restarted by your SIGALRM (or just retry test)"; - undef $not; - last; - } - my $exp = 0.3 * (5 - $i); - # This test is more sensitive, so impose a softer limit. - if (abs($ival/$exp - 1) > 3*$limit) { - my $ratio = abs($ival/$exp); - $not = "while: $exp sleep took $ival ratio $ratio"; - last; - } - $ok = $i; + my $exp = 0.3 * (5 - $i); + # This test is more sensitive, so impose a softer limit. + if (abs($ival/$exp - 1) > 3*$limit) { + my $ratio = abs($ival/$exp); + $not = "while: $exp sleep took $ival ratio $ratio"; + last; } - } else { - $ok = "Skip: VMS select() does not get interrupted."; + $ok = $i; } sub tick @@ -325,13 +318,10 @@ unless ( defined &Time::HiRes::gettimeofday } } - - if ($^O ne 'VMS') { - if ($use_sigaction) { - POSIX::sigaction(&POSIX::SIGALRM, $oldaction); - } else { - alarm(0); # can't cancel usig %SIG - } + if ($use_sigaction) { + POSIX::sigaction(&POSIX::SIGALRM, $oldaction); + } else { + alarm(0); # can't cancel usig %SIG } print $not ? "not ok 17 # $not\n" : "ok 17 # $ok\n"; @@ -340,7 +330,8 @@ unless ( defined &Time::HiRes::gettimeofday unless ( defined &Time::HiRes::setitimer && defined &Time::HiRes::getitimer && has_symbol('ITIMER_VIRTUAL') - && $Config{sig_name} =~ m/\bVTALRM\b/) { + && $Config{sig_name} =~ m/\bVTALRM\b/ + && $^O =~ /^(nto)$/) { # nto: QNX 6 has the API but no implementation for (18..19) { print "ok $_ # Skip: no virtual interval timers\n"; } -- 2.7.4