Upgrade to Time-HiRes-1.82
[p5sagit/p5-mst-13.2.git] / ext / Time / HiRes / HiRes.pm
index 6064fb5..ffb027f 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.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()>, and
-C<select()>, 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
@@ -318,13 +319,13 @@ of C<CLOCK_REALTIME>,  see L</clock_gettime>.
   use Time::HiRes qw(usleep ualarm gettimeofday tv_interval);
 
   $microseconds = 750_000;
-  usleep $microseconds;
+  usleep($microseconds);
 
   # signal alarm in 2.5s & every .1s thereafter
-  ualarm 2_500_000, 100_000;   
+  ualarm(2_500_000, 100_000);
 
   # get seconds and microseconds since the epoch
-  ($s, $usec) = gettimeofday;
+  ($s, $usec) = gettimeofday();
 
   # measure elapsed time 
   # (could also do by subtracting 2 gettimeofday return values)
@@ -359,9 +360,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 +417,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