summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2005-11-06 18:38:02 +0000
committerSteve Peters <steve@fisharerojo.org>2005-11-06 18:38:02 +0000
commit82cbdcc3d460f16b26646afbb27f32075e0e0595 (patch)
treeff3dc905d59930d23595fcda3dfbe0f8a6a1aa42 /ext
parenteca5cfc524b79d02ce8c602dab1c0e338ed516f7 (diff)
downloadperl-82cbdcc3d460f16b26646afbb27f32075e0e0595.tar.gz
Upgrade to Time-HiRes-1.82
p4raw-id: //depot/perl@26021
Diffstat (limited to 'ext')
-rw-r--r--ext/Time/HiRes/Changes11
-rw-r--r--ext/Time/HiRes/HiRes.pm13
-rw-r--r--ext/Time/HiRes/HiRes.xs14
-rw-r--r--ext/Time/HiRes/Makefile.PL4
-rw-r--r--ext/Time/HiRes/t/HiRes.t10
5 files changed, 40 insertions, 12 deletions
diff --git a/ext/Time/HiRes/Changes b/ext/Time/HiRes/Changes
index 391753ad01..a31ab0737f 100644
--- a/ext/Time/HiRes/Changes
+++ b/ext/Time/HiRes/Changes
@@ -1,5 +1,12 @@
Revision history for Perl extension Time::HiRes.
+1.82 [2005-10-06]
+ - CLOCK_REALTIME is an enum value (of the clockid_t enum)
+ in HP-UX (and might be so elsewhere, too), debugged by
+ H. Merijn Brand
+ - include const-c.inc as late as possible (from Randy Kobes,
+ [rt.cpan.org #15552] to avoid undefined usleep() on Win32
+
1.81 [2005-10-05]
- try to be more robust and consistent in the detection of
CLOCK_REALTIME and ITIMER_VIRTUAL in HiRes.t: the proper
@@ -134,7 +141,9 @@ Revision history for Perl extension Time::HiRes.
- fix the 'hierachy' typo in Makefile.PL [rt.cpan.org #8492]
- should now build in Solaris [rt.cpan.org #7165] (since 1.64)
- should now build in Cygwin [rt.cpan.org #7535] (since 1.64)
- - close also [rt.cpan.org #5933] "Time::HiRes::time does not pick up time adjustments like ntp" since ever reproducing it in the same environment
+ - close also [rt.cpan.org #5933] "Time::HiRes::time does not
+ pick up time adjustments like ntp" since ever reproducing it
+ (and therefore verifying a possible fix) in the same environment
has become rather unlikely
1.65 [2004-09-18]
diff --git a/ext/Time/HiRes/HiRes.pm b/ext/Time/HiRes/HiRes.pm
index 2f781d38fd..ffb027fd2b 100644
--- a/ext/Time/HiRes/HiRes.pm
+++ b/ext/Time/HiRes/HiRes.pm
@@ -17,7 +17,7 @@ require DynaLoader;
d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer
d_nanosleep d_clock_gettime d_clock_getres);
-$VERSION = '1.81';
+$VERSION = '1.82';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -105,7 +105,8 @@ Time::HiRes - High resolution alarm, sleep, gettimeofday, interval timers
setitimer ($which, $floating_seconds, $floating_interval );
getitimer ($which);
- $realtime = clock_gettime(CLOCK_REALTIME);
+ $realtime = clock_gettime(CLOCK_REALTIME);
+ $resolution = clock_getres(CLOCK_REALTIME);
=head1 DESCRIPTION
@@ -119,10 +120,10 @@ C<gettimeofday>, and C<setitimer>/C<getitimer> calls.
If your system lacks C<gettimeofday()> or an emulation of it you don't
get C<gettimeofday()> or the one-argument form of C<tv_interval()>.
-If your system lacks all of C<nanosleep()>, C<usleep()>, C<select()>,
-and C<poll()>, you don't get C<Time::HiRes::usleep()>,
-C<Time::HiRes::nanosleep()>, or C<Time::HiRes::sleep()>. If your
-system lacks both C<ualarm()> and C<setitimer()> you don't get
+If your system lacks all of C<nanosleep()>, C<usleep()>,
+C<select()>, and C<poll>, you don't get C<Time::HiRes::usleep()>,
+C<Time::HiRes::nanosleep()>, or C<Time::HiRes::sleep()>.
+If your system lacks both C<ualarm()> and C<setitimer()> you don't get
C<Time::HiRes::ualarm()> or C<Time::HiRes::alarm()>.
If you try to import an unimplemented function in the C<use> statement
diff --git a/ext/Time/HiRes/HiRes.xs b/ext/Time/HiRes/HiRes.xs
index 201e99fc08..d4d13048a0 100644
--- a/ext/Time/HiRes/HiRes.xs
+++ b/ext/Time/HiRes/HiRes.xs
@@ -65,7 +65,17 @@ extern "C" {
# endif
#endif
-#include "const-c.inc"
+#if defined(TIME_HIRES_CLOCK_GETTIME) && defined(_STRUCT_ITIMERSPEC)
+
+/* HP-UX has CLOCK_XXX values but as enums, not as defines.
+ * The only way to detect these would be to test compile for each. */
+# ifdef __hpux
+# define CLOCK_REALTIME CLOCK_REALTIME
+# define CLOCK_VIRTUAL CLOCK_VIRTUAL
+# define CLOCK_PROFILE CLOCK_PROFILE
+# endif /* # ifdef __hpux */
+
+#endif /* #if defined(TIME_HIRES_CLOCK_GETTIME) && defined(_STRUCT_ITIMERSPEC) */
#if defined(WIN32) || defined(CYGWIN_WITH_W32API)
@@ -678,6 +688,8 @@ myNVtime()
#endif /* #ifdef HAS_GETTIMEOFDAY */
+#include "const-c.inc"
+
MODULE = Time::HiRes PACKAGE = Time::HiRes
PROTOTYPES: ENABLE
diff --git a/ext/Time/HiRes/Makefile.PL b/ext/Time/HiRes/Makefile.PL
index bfa65e07cc..0105609b22 100644
--- a/ext/Time/HiRes/Makefile.PL
+++ b/ext/Time/HiRes/Makefile.PL
@@ -594,9 +594,9 @@ sub doConstants {
d_nanosleep d_clock_gettime d_clock_getres)) {
my $macro = $_;
if ($macro =~ /^(d_nanosleep|d_clock_gettime|d_clock_getres)$/) {
- $macro =~ s/d_(.*)/TIME_HIRES_\U$1/;
+ $macro =~ s/^d_(.+)/TIME_HIRES_\U$1/;
} else {
- $macro =~ s/d_(.*)/HAS_\U$1/;
+ $macro =~ s/^d_(.+)/HAS_\U$1/;
}
push @names, {name => $_, macro => $macro, value => 1,
default => ["IV", "0"]};
diff --git a/ext/Time/HiRes/t/HiRes.t b/ext/Time/HiRes/t/HiRes.t
index efa8ba6fb9..5bee26f72c 100644
--- a/ext/Time/HiRes/t/HiRes.t
+++ b/ext/Time/HiRes/t/HiRes.t
@@ -54,6 +54,8 @@ import Time::HiRes 'clock_getres' if $have_clock_getres;
use Config;
+use Time::HiRes qw(gettimeofday);
+
my $have_alarm = $Config{d_alarm};
my $have_fork = $Config{d_fork};
my $waitfor = 60; # 10-20 seconds is normal (load affects this).
@@ -140,6 +142,7 @@ unless ($have_usleep) {
skip 7..8;
}
else {
+ use Time::HiRes qw(usleep);
my $one = time;
usleep(10_000);
my $two = time;
@@ -178,7 +181,7 @@ unless ($have_usleep && $have_gettimeofday) {
skip 11;
}
else {
- my $r = [gettimeofday()];
+ my $r = [ gettimeofday() ];
Time::HiRes::sleep( 0.5 );
my $f = tv_interval $r;
ok 11, $f > 0.4 && $f < 0.9, "slept $f instead of 0.5 secs.";
@@ -333,7 +336,10 @@ unless ( defined &Time::HiRes::setitimer
$SIG{VTALRM} = 'DEFAULT';
}
-if ($have_gettimeofday) {
+if ($have_gettimeofday &&
+ $have_usleep) {
+ use Time::HiRes qw(usleep);
+
my ($t0, $td);
my $sleep = 1.5; # seconds