From 1a7d3a53c8d75f177742303cc1960c495ac8672f Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 3 Nov 2005 20:28:20 +0000 Subject: [PATCH] Upgrade to Time-HiRes-1.78 p4raw-id: //depot/perl@25978 --- ext/Time/HiRes/Changes | 5 +++++ ext/Time/HiRes/HiRes.pm | 12 +++++++----- ext/Time/HiRes/t/HiRes.t | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ext/Time/HiRes/Changes b/ext/Time/HiRes/Changes index 60f5c71..c23031c 100644 --- a/ext/Time/HiRes/Changes +++ b/ext/Time/HiRes/Changes @@ -1,5 +1,10 @@ Revision history for Perl extension Time::HiRes. +1.78 [2005-10-03] + - ITIMER_VIRTUAL detection in HiRes.t had problems (that we cannot + in the general case fail already at 'use' is suboptimal) + - fixes to the documentation of clock_gettime() and clock_getres() + 1.77 [2005-10-03] - add support for the POSIX clock_gettime() and clock_getres(), if available, either as library calls or as syscalls diff --git a/ext/Time/HiRes/HiRes.pm b/ext/Time/HiRes/HiRes.pm index 6064fb5..cdafff5 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.77'; +$VERSION = '1.78'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -359,9 +359,11 @@ of C, see L. $SIG{VTALRM} = sub { print time, "\n" }; setitimer(ITIMER_VIRTUAL, 10, 2.5); - # How accurate we can be, really? - - my $reso = clock_gettime(CLOCK_REALTIME); + use Time::HiRes qw( clock_gettime clock_getres CLOCK_REALTIME ); + # Read the POSIX high resolution timer. + my $high = clock_getres(CLOCK_REALTIME); + # But how accurate we can be, really? + my $reso = clock_getres(CLOCK_REALTIME); =head1 C API @@ -414,7 +416,7 @@ platforms like Cygwin and MinGW) the Time::HiRes::time() may temporarily drift off from the system clock (and the original time()) by up to 0.5 seconds. Time::HiRes will notice this eventually and recalibrate. Note that since Time::HiRes 1.77 the clock_gettime(CLOCK_MONOTONIC) -might help in this (in case your system supports it). +might help in this (in case your system supports CLOCK_MONOTONIC). =head1 SEE ALSO diff --git a/ext/Time/HiRes/t/HiRes.t b/ext/Time/HiRes/t/HiRes.t index 93af2c6..25a97b5 100644 --- a/ext/Time/HiRes/t/HiRes.t +++ b/ext/Time/HiRes/t/HiRes.t @@ -285,7 +285,8 @@ unless ( defined &Time::HiRes::gettimeofday unless ( defined &Time::HiRes::setitimer && defined &Time::HiRes::getitimer - && exists &Time::HiRes::ITIMER_VIRTUAL + && eval 'use Time::HiRes qw(ITIMER_VIRTUAL); print ITIMER_VIRTUAL' + && $Config{d_select} && $Config{d_select} && $Config{sig_name} =~ m/\bVTALRM\b/) { for (18..19) { -- 2.7.4