[Orca-checkins] r485 - in orca/trunk: . packages/Time-HiRes-1.73 packages/Time-HiRes-1.73/hints packages/Time-HiRes-1.73/t

blair at orcaware.com blair at orcaware.com
Mon Sep 5 14:33:38 PDT 2005


Author: blair at orcaware.com
Date: Mon Sep  5 14:32:43 2005
New Revision: 485

Added:
   orca/trunk/packages/Time-HiRes-1.73/
      - copied from r484, /orca/trunk/packages/Time-HiRes-1.68/
Removed:
   orca/trunk/packages/Time-HiRes-1.68/
Modified:
   orca/trunk/configure.in
   orca/trunk/packages/Time-HiRes-1.73/Changes
   orca/trunk/packages/Time-HiRes-1.73/HiRes.pm
   orca/trunk/packages/Time-HiRes-1.73/HiRes.xs
   orca/trunk/packages/Time-HiRes-1.73/META.yml
   orca/trunk/packages/Time-HiRes-1.73/Makefile.PL
   orca/trunk/packages/Time-HiRes-1.73/README
   orca/trunk/packages/Time-HiRes-1.73/hints/solaris.pl
   orca/trunk/packages/Time-HiRes-1.73/t/HiRes.t

Log:
Upgrade Time::HiRes from 1.68 to 1.73.

* configure.in:
  Bump Time::HiRes's version number to 1.73.

* packages/Time-HiRes-1.73:
  Renamed from packages/Time-HiRes-1.68.  Directory contents updated
  from Time-HiRes-1.73.tar.gz.


Modified: orca/trunk/configure.in
==============================================================================
--- orca/trunk/configure.in	(original)
+++ orca/trunk/configure.in	Mon Sep  5 14:32:43 2005
@@ -39,8 +39,8 @@
 RRDTOOL_VER=1.000502
 STORABLE_DIR=Storable-2.15
 STORABLE_VER=2.15
-TIME_HIRES_DIR=Time-HiRes-1.68
-TIME_HIRES_VER=1.68
+TIME_HIRES_DIR=Time-HiRes-1.73
+TIME_HIRES_VER=1.73
 
 AC_SUBST(DATA_DUMPER_DIR)
 AC_SUBST(DATE_PARSE_DIR)

Modified: orca/trunk/packages/Time-HiRes-1.73/Changes
==============================================================================
--- /orca/trunk/packages/Time-HiRes-1.68/Changes	(original)
+++ orca/trunk/packages/Time-HiRes-1.73/Changes	Mon Sep  5 14:32:43 2005
@@ -1,5 +1,40 @@
 Revision history for Perl extension Time::HiRes.
 
+1.73	- Time::HiRes::nanosleep support for Solaris [PATCH]
+	  (POSIX::uname() not available if building with core perl,
+	   from Gisle Aas, via perl5-porters, perl change #25295)
+
+1.72	- going back to the 1.68 loader setup (using DynaLoader)
+	  since too many weird things starting breaking
+	- fix a typo in José Auguste-Etienne's name
+
+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
+
+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
+	  (realtime POSIX?) libs and whatnot, but in the general case
+	  running a real test case is better.  (Of course, this change
+	  will no doubt run into portability problems because of the
+	  execution step...)  Note that because of hysterical raisins
+	  most Perls do NOT have $Config{d_nanosleep} (scanning for
+	  it by Configure would in many platforms require linking in
+	  things like -lrt, which would in many platforms be a bad idea
+	  for Perl itself).
+	  (from José Auguste-Etienne)
+	- support XSLoader also since it's much faster
+	  (from Alexey Tourbin)
+	- add SEE ALSO (BSD::Resource and Time::TAI64)
+
 1.68
 	- somehow 1.67 had a lot of doubled lines (a major cut-and-paste
 	  error suspected), but miraculously it still worked since the
@@ -251,10 +286,23 @@
 	    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
@@ -360,6 +408,10 @@
 	- 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 at stian.demon.co.uk>
@@ -371,6 +423,8 @@
 	- 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
@@ -378,6 +432,9 @@
 	  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.
@@ -389,6 +446,22 @@
 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 at 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

Modified: orca/trunk/packages/Time-HiRes-1.73/HiRes.pm
==============================================================================
--- /orca/trunk/packages/Time-HiRes-1.68/HiRes.pm	(original)
+++ orca/trunk/packages/Time-HiRes-1.73/HiRes.pm	Mon Sep  5 14:32:43 2005
@@ -15,7 +15,7 @@
 		 d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer
 		 d_nanosleep);
 	
-$VERSION = '1.68';
+$VERSION = '1.73';
 $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
@@ -24,7 +24,10 @@
     ($constname = $AUTOLOAD) =~ s/.*:://;
     die "&Time::HiRes::constant not defined" if $constname eq 'constant';
     my ($error, $val) = constant($constname);
-    if ($error) { die $error; }
+    if ($error) {
+        my (undef,$file,$line) = caller;
+        die "$error at $file line $line.\n";
+    }
     {
 	no strict 'refs';
 	*$AUTOLOAD = sub { $val };
@@ -111,9 +114,9 @@
 then carefully read your C<nanosleep()> C API documentation for any
 peculiarities.
 
-Unless using C<nanosleep> for mixing sleeping with signals, give
-some thought to whether Perl is the tool you should be using for
-work requiring nanosecond accuracies.
+If you are using C<nanosleep> for something else than mixing sleeping
+with signals, give some thought to whether Perl is the tool you should
+be using for work requiring nanosecond accuracies.
 
 The following functions can be imported from this module.
 No functions are exported by default.
@@ -326,8 +329,8 @@
 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:
 
@@ -363,6 +366,10 @@
 drift off from the system clock (and the original time())  by up to 0.5
 seconds. Time::HiRes will notice this eventually and recalibrate.
 
+=head1 SEE ALSO
+
+L<BSD::Resource>, L<Time::TAI64>.
+
 =head1 AUTHORS
 
 D. Wegscheid <wegscd at whirlpool.com>
@@ -374,7 +381,7 @@
 
 Copyright (c) 1996-2002 Douglas E. Wegscheid.  All rights reserved.
 
-Copyright (c) 2002,2003,2004 Jarkko Hietaniemi.  All rights reserved.
+Copyright (c) 2002, 2003, 2004, 2005 Jarkko Hietaniemi.  All rights reserved.
 
 This program is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.

Modified: orca/trunk/packages/Time-HiRes-1.73/HiRes.xs
==============================================================================
--- /orca/trunk/packages/Time-HiRes-1.68/HiRes.xs	(original)
+++ orca/trunk/packages/Time-HiRes-1.73/HiRes.xs	Mon Sep  5 14:32:43 2005
@@ -1,3 +1,13 @@
+/*
+ * 
+ * Copyright (c) 1996-2002 Douglas E. Wegscheid.  All rights reserved.
+ * 
+ * Copyright (c) 2002,2003,2004,2005 Jarkko Hietaniemi.  All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the same terms as Perl itself.
+ */
+
 #ifdef __cplusplus
 extern "C" {
 #endif

Modified: orca/trunk/packages/Time-HiRes-1.73/META.yml
==============================================================================
--- /orca/trunk/packages/Time-HiRes-1.68/META.yml	(original)
+++ orca/trunk/packages/Time-HiRes-1.73/META.yml	Mon Sep  5 14:32:43 2005
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Time-HiRes
-version:      1.68
+version:      1.73
 version_from: HiRes.pm
 installdirs:  perl
 requires:

Modified: orca/trunk/packages/Time-HiRes-1.73/Makefile.PL
==============================================================================
--- /orca/trunk/packages/Time-HiRes-1.68/Makefile.PL	(original)
+++ orca/trunk/packages/Time-HiRes-1.73/Makefile.PL	Mon Sep  5 14:32:43 2005
@@ -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 @@
 my $VERBOSE = $ENV{VERBOSE};
 my $DEFINE;
 my $LIBS = [];
-my $XSOPT;
+my $XSOPT = '';
 
 use vars qw($self); # Used in 'sourcing' the hints.
 
@@ -135,16 +142,30 @@
 	    printf "cccmd = $cccmd\n" if $VERBOSE;
 	    my $res = system($cccmd);
 	    $ok = defined($res) && $res==0 && -s $tmp_exe && -x _;
+
+	    if ( $ok && exists $args{run} && $args{run}) {
+		my $abs_tmp_exe =
+		    File::Spec->
+			catfile(File::Spec->rel2abs(File::Spec->curdir),
+				$tmp_exe);
+		printf "Running $abs_tmp_exe..." if $VERBOSE;
+		if (system($abs_tmp_exe) == 0) {
+		    $ok = 1;
+		} else {
+		    $ok = 0;
+		    print "[ system('$abs_tmp_exe') failed: status $? ] ";
+		}
+	    }
 	    unlink("$tmp.c", $tmp_exe);
         }
     }
 
-    $ok;
+    return $ok;
 }
 
 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"
@@ -202,6 +223,32 @@
     return 0;
 }
 
+sub has_nanosleep {
+    print "Trying out nanosleep... ";
+    return 1 if
+    try_compile_and_link(<<EOM, run => 1);
+#include <time.h>
+#include <sys/time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+/* int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); */
+
+int main() {
+    struct timespec ts1, ts2;
+    int ret;
+    ts1.tv_sec  = 0;
+    ts1.tv_nsec = 750000000;
+    ts2.tv_sec  = 0;
+    ts2.tv_nsec = 0;
+    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
+}
+
 sub has_include {
     my ($inc) = @_;
     return 1 if
@@ -327,7 +374,7 @@
     } 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 {
@@ -338,13 +385,14 @@
 
     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';
 	}
     } elsif ($^O ne 'mpeix' && # MPE/iX falsely finds nanosleep.
-             has_x ("nanosleep (NULL, NULL)")) {
+             has_nanosleep()) {
 	$has_nanosleep++;
 	$DEFINE .= ' -DTIME_HIRES_NANOSLEEP';
     }

Modified: orca/trunk/packages/Time-HiRes-1.73/README
==============================================================================
--- /orca/trunk/packages/Time-HiRes-1.68/README	(original)
+++ orca/trunk/packages/Time-HiRes-1.73/README	Mon Sep  5 14:32:43 2005
@@ -3,41 +3,6 @@
 Implement usleep, ualarm, and gettimeofday for Perl, as well as wrappers
 to implement time, sleep, and alarm that know about non-integral seconds.
 
-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 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.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 has better VMS support.
-
-1.18 has limited Win32 support (no ualarm). Added usleep for Win32.
-Probably buggy. I'm sure I'll hear.
-
-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 at argon.org> did all 
-the conditional compilation stuff, look at HiRes.pm and the test suites; 
-it's good educational reading.
-
 Note: the tests of this module are by definition time sensitive: under
 heavy loads the tests may fail.  Reasonable relaxed criteria are being
 used for the tests but sometimes you may still see transient failures.
@@ -46,16 +11,16 @@
 
 Also, older versions of Perl do not support '-nolinenumbers' on the XSUBPP
 command, however, 5.004_03 requires it (on my box, anyway) since the #line
-generating code in XSUBPP appears to have problems with #ifdef'd .xs code. If
-xsubpp complains about usage when you do a make, look at the top of the
-Makefile.PL and comment out the "$XSOPT=" line. Or upgrade to a newer version
-of Perl.
+generating code in XSUBPP appears to have problems with #ifdef'd .xs code.
+If xsubpp complains about usage when you do a make, look at the top of
+the Makefile.PL and comment out the "$XSOPT=" line. Or upgrade to a
+newer version of Perl.
 
 POD documentation is embedded.
 
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Douglas E. Wegscheid.
 
-Copyright (c) 2002 Jarkko Hietaniemi.  All rights reserved.
+Copyright (c) 2002, 2003, 2004, 2005 Jarkko Hietaniemi.  All rights reserved.
 
 All rights reserved. This program is free software; you can 
 redistribute it and/or modify it under the same terms as Perl itself.

Modified: orca/trunk/packages/Time-HiRes-1.73/hints/solaris.pl
==============================================================================
--- /orca/trunk/packages/Time-HiRes-1.68/hints/solaris.pl	(original)
+++ orca/trunk/packages/Time-HiRes-1.73/hints/solaris.pl	Mon Sep  5 14:32:43 2005
@@ -1,6 +1,7 @@
-use POSIX qw(uname);
 # 2.6 has nanosleep in -lposix4, after that it's in -lrt
-if (substr((uname())[2], 2) <= 6) {
+my $r = `/usr/bin/uname -r`;
+chomp($r);
+if (substr($r, 2) <= 6) {
     $self->{LIBS} = ['-lposix4'];
 } else {
     $self->{LIBS} = ['-lrt'];

Modified: orca/trunk/packages/Time-HiRes-1.73/t/HiRes.t
==============================================================================
--- /orca/trunk/packages/Time-HiRes-1.68/t/HiRes.t	(original)
+++ orca/trunk/packages/Time-HiRes-1.73/t/HiRes.t	Mon Sep  5 14:32:43 2005
@@ -14,7 +14,7 @@
 
 BEGIN { $| = 1; print "1..28\n"; }
 
-END {print "not ok 1\n" unless $loaded;}
+END { print "not ok 1\n" unless $loaded }
 
 use Time::HiRes qw(tv_interval);
 



More information about the Orca-checkins mailing list