summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-29 09:56:27 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-29 09:56:27 +0000
commit22149ad2867115363d728090e454e2fd3493f96a (patch)
tree4f2289577864964fa8c95d2dfbd7c4f0962a80ba /ext
parent185a8799cf53821042b26b9640dafc4ccbe89485 (diff)
downloadperl-22149ad2867115363d728090e454e2fd3493f96a.tar.gz
Upgrade to Time::HiRes 1.9709
p4raw-id: //depot/perl@32549
Diffstat (limited to 'ext')
-rw-r--r--ext/Time/HiRes/Changes8
-rw-r--r--ext/Time/HiRes/HiRes.pm2
-rw-r--r--ext/Time/HiRes/HiRes.xs8
-rw-r--r--ext/Time/HiRes/Makefile.PL5
-rw-r--r--ext/Time/HiRes/t/HiRes.t101
5 files changed, 63 insertions, 61 deletions
diff --git a/ext/Time/HiRes/Changes b/ext/Time/HiRes/Changes
index d58aa9c0a6..6c13f24df6 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 e100bda7e4..b1512cfbb9 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 731df21bce..25c56332f3 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 cc725b2a59..15d72e8821 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 <<EOM;
+ print <<EOM;
+
NOTE: if you get an error like this (the Makefile line number may vary):
Makefile:91: *** missing separator
then set the environment variable LC_ALL to "C" and retry
from scratch (re-run perl "Makefile.PL").
(And consider upgrading your Perl.)
+(You got this message because you seem to have an
+ UTF-8 locale active in your shell environment.)
EOM
}
}
diff --git a/ext/Time/HiRes/t/HiRes.t b/ext/Time/HiRes/t/HiRes.t
index 95046a43c0..69ff214309 100644
--- a/ext/Time/HiRes/t/HiRes.t
+++ b/ext/Time/HiRes/t/HiRes.t
@@ -68,7 +68,7 @@ use Time::HiRes qw(gettimeofday);
my $have_alarm = $Config{d_alarm};
my $have_fork = $Config{d_fork};
-my $waitfor = 90; # 30-45 seconds is normal (load affects this).
+my $waitfor = 180; # 30-45 seconds is normal (load affects this).
my $timer_pid;
my $TheEnd;
@@ -107,13 +107,13 @@ if (open(XDEFINE, "xdefine")) {
# However, if the system is busy, there are no guarantees on how
# quickly we will return. This limit used to be 10%, but that
# was occasionally triggered falsely.
-# Try 20%.
+# Try 25%.
# Another possibility might be to print "ok" if the test completes fine
# with (say) 10% slosh, "skip - system may have been busy?" if the test
# completes fine with (say) 30% slosh, and fail otherwise. If you do that,
# consider changing over to test.pl at the same time.
# --A.D., Nov 27, 2001
-my $limit = 0.20; # 20% is acceptable slosh for testing timers
+my $limit = 0.25; # 20% is acceptable slosh for testing timers
sub skip {
map { print "ok $_ # skipped\n" } @_;
@@ -261,54 +261,47 @@ unless ( defined &Time::HiRes::gettimeofday
sleep (0.5);
print "# sleep...", Time::HiRes::tv_interval($r), "\nok 16\n";
+ $r = [Time::HiRes::gettimeofday()];
+ $i = 5;
my $oldaction;
+ 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";
+ }
- # 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";
}