Upgrade to Time::HiRes 1.71
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 28 Jun 2005 07:40:35 +0000 (07:40 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 28 Jun 2005 07:40:35 +0000 (07:40 +0000)
p4raw-id: //depot/perl@25002

ext/Time/HiRes/Changes
ext/Time/HiRes/HiRes.pm
ext/Time/HiRes/Makefile.PL

index 0cc806c..8c148df 100644 (file)
@@ -1,11 +1,16 @@
 Revision history for Perl extension Time::HiRes.
 
+1.71   - a thinko in the nanosleep() detection
+       - move more changes stuff from the README to Changes
+       - add -w to the Makefile.PL
+
 1.70   - oops in 1.69 about @ISA (not affecting anything but silly)
        - add copyright 2005 to HiRes.pm
        - add copyright and license to HiRes.xs
-       - add copyrights 2003,2004,2005 to README
+       - add copyrights 2003, 2004, 2005 to README
 
-1.69   - actually run a test for nanosleep since e.g. in AIX 4.2
+1.69   - actually run a test for nanosleep
+         (if there is no $Config{d_nanosleep}) since e.g. in AIX 4.2
          it seems that one can link in nanosleep() but then calling
          it fails instantly and sets errno to ENOSYS (Not implemented).
          This may be fixable in the AIX case by figuring out the right
@@ -269,10 +274,23 @@ Revision history for Perl extension Time::HiRes.
            the IVSIZE might not be defined)
          - define NVgf if needed
          - grab the typemap from 5.8.0 for the NV stuff
+
+       1.31 and 1.32 add more backward compatibility (now all the way
+       back to Perl 5.00404), and using nanosleep() (if available) for
+       subsecond sleeps.
+
 1.30
 
        - release 1.29_02 as 1.30
 
+       1.30 adds all the changes made during the Perl 5.6->5.7->5.8
+       development cycle.  Most notably portability across platforms has been
+       enhanced, and the interval timers (setitimer, getitimer) have been
+       added.  Note that the version of Time::HiRes that is included in Perl
+       5.8.0 calls itself 1.20_00, but it is equivalent to this Time::HiRes
+       version.  Note also that in 1.30 Wegscheid turns over the maintenance
+       to Jarkko Hietaniemi.
+
 1.29_02
 
        - fix a silly unclosed comment typo in HiRes.xs
@@ -378,6 +396,10 @@ Revision history for Perl extension Time::HiRes.
        - hopefully correct "-lc" fix for SCO.
        - add PPD stuff
 
+       1.20 adds a platform neutral set of C accessible routines if you are
+       running 5.005+.  All other changes are packaging changes and build
+       fixes(?) for statically linked Perl, SCO, and VMS.
+
 1.19  Tue Sep 29 22:30 1998
        - put VMS gettimeofday() in. Patch is from Sebastian Bazley
          <seb@stian.demon.co.uk>
@@ -389,6 +411,8 @@ Revision history for Perl extension Time::HiRes.
        - fix Makefile.PL (more) so that detection of gettimeofday is
          more correct.
 
+       1.19 has better VMS support.
+
 1.18  Mon Jul 6 22:40 1998
        - add usleep() for Win32.
        - fix Makefile.PL to fix reported HP/UX feature where unresolved
@@ -396,6 +420,9 @@ Revision history for Perl extension Time::HiRes.
          x bit set). Thanks to David Kozinn for report and explanation.
          Problems with the fix are mine :)
 
+       1.18 has limited Win32 support (no ualarm). Added usleep for Win32.
+       Probably buggy. I'm sure I'll hear.
+
 1.17  Wed Jul 1 20:10 1998
        - fix setitimer calls so microseconds is not more than 1000000.
          Hp/UX 9 doesn't like that. Provided by Roland B Robert, PhD.
@@ -407,6 +434,22 @@ Revision history for Perl extension Time::HiRes.
 1.16  Wed Nov 12 21:05 1997
        - add missing EXTEND in new gettimeofday scalar code.
 
+       1.16+ should be closer to building out of the box on Linux. Thanks
+       to Gisle Aas for patches, and the ualarm equivalent using setitimer.
+
+       If your underlying operating system doesn't implement ualarm(), then
+       a fake using setitimer() will be made.  If the OS is missing usleep(),
+       a fake one using select() will be made. If a fake can't be made for
+       either ualarm() or usleep(), then the corresponding Perl function will
+       not be available.  If the OS is missing gettimeofday(), you will get
+       unresolved externals, either at link- or run-time.
+
+       This is an improvement; the package used to not even build if
+       you were missing any of these bits. Roderick Schertler
+
+       <roderick@argon.org> did all the conditional compilation stuff,
+       look at HiRes.pm and the test suites; it's good educational reading.
+
 1.15  Mon Nov 10 21:30 1997
        - HiRes.pm: update pod. Provided by Gisle Aas.
        - HiRes.xs: if gettimeofday() called in scalar context, do
index 88bab3f..0cbbba4 100644 (file)
@@ -15,7 +15,7 @@ require DynaLoader;
                 d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer
                 d_nanosleep);
        
-$VERSION = '1.70';
+$VERSION = '1.71';
 $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
@@ -334,8 +334,8 @@ modglobal hash:
 Both functions return equivalent information (like C<gettimeofday>)
 but with different representations.  The names C<NVtime> and C<U2time>
 were selected mainly because they are operating system independent.
-(C<gettimeofday> is Unix-centric, though some platforms like VMS have
-emulations for it.)
+(C<gettimeofday> is Unix-centric, though some platforms like Win32 and
+VMS have emulations for it.)
 
 Here is an example of using C<NVtime> from C:
 
index fe547ab..7262381 100644 (file)
@@ -1,3 +1,10 @@
+#!/usr/bin/perl
+#
+# In general we trust %Config, but for nanosleep() this trust
+# may be misplaces (it may be linkable but not really functional).
+# Use $ENV{FORCE_NANOSLEEP_SCAN} to force rescanning whether there
+# really is hope.
+
 require 5.002;
 
 use Config;
@@ -7,7 +14,7 @@ use strict;
 my $VERBOSE = $ENV{VERBOSE};
 my $DEFINE;
 my $LIBS = [];
-my $XSOPT;
+my $XSOPT = '';
 
 use vars qw($self); # Used in 'sourcing' the hints.
 
@@ -143,8 +150,9 @@ sub try_compile_and_link {
                                $tmp_exe);
                printf "Running $abs_tmp_exe..." if $VERBOSE;
                if (system($abs_tmp_exe) == 0) {
-                   $ok = $? == 0;
+                   $ok = 1;
                } else {
+                   $ok = 0;
                    print "system('$abs_tmp_exe') failed: $?\n";
                }
            }
@@ -157,7 +165,7 @@ sub try_compile_and_link {
 
 sub has_gettimeofday {
     # confusing but true (if condition true ==> -DHAS_GETTIMEOFDAY already)
-    return 0 if $Config{d_gettimeod} eq 'define';
+    return 0 if $Config{d_gettimeod};
     return 1 if try_compile_and_link(<<EOM);
 #include "EXTERN.h"
 #include "perl.h"
@@ -216,6 +224,7 @@ EOM
 }
 
 sub has_nanosleep {
+    print "Trying out nanosleep... ";
     return 1 if
     try_compile_and_link(<<EOM, run => 1);
 #include <time.h>
@@ -228,12 +237,14 @@ sub has_nanosleep {
 
 int main() {
     struct timespec ts1, ts2;
+    int ret;
     ts1.tv_sec  = 0;
     ts1.tv_nsec = 750000000;
     ts2.tv_sec  = 0;
     ts2.tv_nsec = 0;
-    nanosleep(&ts1, &ts2); /* E.g. in AIX nanosleep() might return ENOSYS. */
-    exit(errno);
+    errno = 0;
+    ret = nanosleep(&ts1, &ts2); /* E.g. in AIX nanosleep() fail and set errno to ENOSYS. */
+    ret == 0 ? exit(0) : exit(errno ? errno : -1);
 }
 EOM
 }
@@ -363,7 +374,7 @@ EOD
     } else {
        print "NOT found.\n";
         print "Let's see if you have select()... ";
-        if ($Config{'d_select'} eq 'define') {
+        if ($Config{'d_select'}) {
            print "found.\n";
            print "We can make a Time::HiRes::usleep().\n";
        } else {
@@ -374,7 +385,8 @@ EOD
 
     print "Looking for nanosleep()... ";
     my $has_nanosleep;
-    if (exists $Config{d_nanosleep}) {
+    if (exists $Config{d_nanosleep} && !$ENV{FORCE_NANOSLEEP_SCAN}) {
+        # Believe $Config{d_nanosleep}.
        if ($Config{d_nanosleep}) {
            $has_nanosleep++;
            $DEFINE .= ' -DTIME_HIRES_NANOSLEEP';