Upgrade to Time-HiRes-1.78
authorSteve Peters <steve@fisharerojo.org>
Thu, 3 Nov 2005 20:28:20 +0000 (20:28 +0000)
committerSteve Peters <steve@fisharerojo.org>
Thu, 3 Nov 2005 20:28:20 +0000 (20:28 +0000)
p4raw-id: //depot/perl@25978

ext/Time/HiRes/Changes
ext/Time/HiRes/HiRes.pm
ext/Time/HiRes/t/HiRes.t

index 60f5c71..c23031c 100644 (file)
@@ -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
index 6064fb5..cdafff5 100644 (file)
@@ -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<CLOCK_REALTIME>,  see L</clock_gettime>.
   $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
 
index 93af2c6..25a97b5 100644 (file)
@@ -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) {