In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/68c5b4dbc1fa93e9864be9a9a2e76bf844b9b783?hp=f2ea78b6b778c254e0ec53141eff7044579533fb>

- Log -----------------------------------------------------------------
commit 68c5b4dbc1fa93e9864be9a9a2e76bf844b9b783
Author: Chris 'BinGOs' Williams <[email protected]>
Date:   Sat Jun 26 23:30:33 2010 +0100

    Update Time-HiRes to CPAN version 1.9721
    
      [DELTA]
    
      1.9721 [2010-03-17]
            - Address [rt.cpan.org #54196] alarm and ularm return values are 
bogus,
              additional fix from Gisle Aas
            - Address [rt.cpan.org #55665] "Bad plan" on Windows,
              report and fix from Jan Dubois
    
      1.9720 [2010-02-14]
            - Address [rt.cpan.org #54196] alarm and ularm return values are 
bogus,
              report and fix from Nicholas Clark
-----------------------------------------------------------------------

Summary of changes:
 Porting/Maintainers.pl      |    2 +-
 cpan/Time-HiRes/.gitignore  |    2 -
 cpan/Time-HiRes/Changes     |   10 ++++++++
 cpan/Time-HiRes/HiRes.pm    |    2 +-
 cpan/Time-HiRes/HiRes.xs    |   30 ++++++++++++++-----------
 cpan/Time-HiRes/Makefile.PL |    2 +-
 cpan/Time-HiRes/t/HiRes.t   |   51 ++++++++++++++++++++++++++++++++++++++++--
 7 files changed, 78 insertions(+), 21 deletions(-)
 delete mode 100644 cpan/Time-HiRes/.gitignore

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 564c59e..462cde4 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1461,7 +1461,7 @@ use File::Glob qw(:case);
     'Time::HiRes' =>
        {
        'MAINTAINER'    => 'zefram',
-       'DISTRIBUTION'  => 'JHI/Time-HiRes-1.9719.tar.gz',
+       'DISTRIBUTION'  => 'JHI/Time-HiRes-1.9721.tar.gz',
        'FILES'         => q[cpan/Time-HiRes],
        'UPSTREAM'      => undef,
        },
diff --git a/cpan/Time-HiRes/.gitignore b/cpan/Time-HiRes/.gitignore
deleted file mode 100644
index a89cf3e..0000000
--- a/cpan/Time-HiRes/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.inc
-/xdefine
diff --git a/cpan/Time-HiRes/Changes b/cpan/Time-HiRes/Changes
index ffec191..c365e99 100644
--- a/cpan/Time-HiRes/Changes
+++ b/cpan/Time-HiRes/Changes
@@ -1,5 +1,15 @@
 Revision history for the Perl extension Time::HiRes.
 
+1.9721 [2010-03-17]
+       - Address [rt.cpan.org #54196] alarm and ularm return values are bogus,
+         additional fix from Gisle Aas
+       - Address [rt.cpan.org #55665] "Bad plan" on Windows,
+         report and fix from Jan Dubois
+
+1.9720 [2010-02-14]
+       - Address [rt.cpan.org #54196] alarm and ularm return values are bogus,
+         report and fix from Nicholas Clark
+
 1.9719 [2009-01-04]
        - As with QNX, Haiku has the API of interval timers but not
          the implementation (bleadperl change #34630), hence skip
diff --git a/cpan/Time-HiRes/HiRes.pm b/cpan/Time-HiRes/HiRes.pm
index da4d45a..f8ca13d 100644
--- a/cpan/Time-HiRes/HiRes.pm
+++ b/cpan/Time-HiRes/HiRes.pm
@@ -23,7 +23,7 @@ require DynaLoader;
                 stat
                );
 
-$VERSION = '1.9719';
+$VERSION = '1.9721';
 $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
diff --git a/cpan/Time-HiRes/HiRes.xs b/cpan/Time-HiRes/HiRes.xs
index 69eee69..1dc2a68 100644
--- a/cpan/Time-HiRes/HiRes.xs
+++ b/cpan/Time-HiRes/HiRes.xs
@@ -2,7 +2,7 @@
  * 
  * Copyright (c) 1996-2002 Douglas E. Wegscheid.  All rights reserved.
  * 
- * Copyright (c) 2002,2003,2004,2005,2006,2007,2008 Jarkko Hietaniemi.
+ * Copyright (c) 2002-2010 Jarkko Hietaniemi.
  * All rights reserved.
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -461,20 +461,20 @@ hrt_usleep(unsigned long usec)
 #if defined(HAS_SETITIMER) && defined(ITIMER_REAL)
 
 static int
-hrt_ualarm_itimero(struct itimerval* itv, int usec, int uinterval)
+hrt_ualarm_itimero(struct itimerval *oitv, int usec, int uinterval)
 {
-   itv->it_value.tv_sec = usec / IV_1E6;
-   itv->it_value.tv_usec = usec % IV_1E6;
-   itv->it_interval.tv_sec = uinterval / IV_1E6;
-   itv->it_interval.tv_usec = uinterval % IV_1E6;
-   return setitimer(ITIMER_REAL, itv, 0);
+   struct itimerval itv;
+   itv.it_value.tv_sec = usec / IV_1E6;
+   itv.it_value.tv_usec = usec % IV_1E6;
+   itv.it_interval.tv_sec = uinterval / IV_1E6;
+   itv.it_interval.tv_usec = uinterval % IV_1E6;
+   return setitimer(ITIMER_REAL, &itv, oitv);
 }
 
 int
 hrt_ualarm_itimer(int usec, int uinterval)
 {
-  struct itimerval itv;
-  return hrt_ualarm_itimero(&itv, usec, uinterval);
+  return hrt_ualarm_itimero(NULL, usec, uinterval);
 }
 
 #ifdef HAS_UALARM
@@ -914,9 +914,11 @@ ualarm(useconds,uinterval=0)
          {
                struct itimerval itv;
                if (hrt_ualarm_itimero(&itv, useconds, uinterval)) {
-                 RETVAL = itv.it_value.tv_sec + IV_1E6 * itv.it_value.tv_usec;
-               } else {
+                 /* To conform to ualarm's interface, we're actually ignoring
+                    an error here.  */
                  RETVAL = 0;
+               } else {
+                 RETVAL = itv.it_value.tv_sec * IV_1E6 + itv.it_value.tv_usec;
                }
          }
 #else
@@ -942,9 +944,11 @@ alarm(seconds,interval=0)
          {
                struct itimerval itv;
                if (hrt_ualarm_itimero(&itv, useconds, uinterval)) {
-                 RETVAL = (NV)itv.it_value.tv_sec + (NV)itv.it_value.tv_usec / 
NV_1E6;
-               } else {
+                 /* To conform to alarm's interface, we're actually ignoring
+                    an error here.  */
                  RETVAL = 0;
+               } else {
+                 RETVAL = itv.it_value.tv_sec + ((NV)itv.it_value.tv_usec) / 
NV_1E6;
                }
          }
 #else
diff --git a/cpan/Time-HiRes/Makefile.PL b/cpan/Time-HiRes/Makefile.PL
index c441998..2b9257a 100644
--- a/cpan/Time-HiRes/Makefile.PL
+++ b/cpan/Time-HiRes/Makefile.PL
@@ -832,7 +832,7 @@ sub doConstants {
 }
 
 sub main {
-    if (-f "Makefile" and -f "xdefine" && !(@ARGV  && $ARGV[0] eq 
'--configure')) {
+    if (-f "xdefine" && !(@ARGV  && $ARGV[0] eq '--configure')) {
        print qq[$0: The "xdefine" exists, skipping the configure step.\n];
        print qq[("$^X $0 --configure" to force the configure step)\n];
     } else {
diff --git a/cpan/Time-HiRes/t/HiRes.t b/cpan/Time-HiRes/t/HiRes.t
index 373c328..0a38e78 100644
--- a/cpan/Time-HiRes/t/HiRes.t
+++ b/cpan/Time-HiRes/t/HiRes.t
@@ -12,7 +12,7 @@ BEGIN {
     }
 }
 
-BEGIN { $| = 1; print "1..40\n"; }
+BEGIN { $| = 1; print "1..48\n"; }
 
 END { print "not ok 1\n" unless $loaded }
 
@@ -102,7 +102,7 @@ if ($have_fork) {
 my $xdefine = ''; 
 
 if (open(XDEFINE, "xdefine")) {
-    chomp($xdefine = <XDEFINE>);
+    chomp($xdefine = <XDEFINE> || "");
     close(XDEFINE);
 }
 
@@ -746,7 +746,7 @@ if ($^O =~ /^(cygwin|MSWin)/) {
 }
 
 unless ($can_subsecond_alarm) {
-    skip 39..40;
+    skip 39..44;
 } else {
     {
        my $alrm;
@@ -764,6 +764,51 @@ unless ($can_subsecond_alarm) {
        1 while time() - $t0 <= 2;
        print $alrm ? "ok 40\n" : "not ok 40\n";
     }
+
+    {
+       my $alrm = 0;
+       $SIG{ALRM} = sub { $alrm++ };
+       my $got = Time::HiRes::alarm(2.7);
+       ok(41, $got == 0, $got);
+
+       my $t0 = time();
+       1 while time() - $t0 <= 1;
+
+       $got = Time::HiRes::alarm(0);
+       ok(42, $got > 0 && $got < 1.8, $got);
+
+       ok(43, $alrm == 0, $alrm);
+
+       $got = Time::HiRes::alarm(0);
+       ok(44, $got == 0, $got);
+    }
+}
+
+unless ($have_ualarm) {
+       skip 45..48;
+}
+else {
+    {
+       my $alrm = 0;
+       $SIG{ALRM} = sub { $alrm++ };
+       my $got = Time::HiRes::ualarm(500_000);
+       ok(45, $got == 0, $got);
+
+       my $t0 = Time::HiRes::time();
+       my $t1;
+       do {
+           $t1 = Time::HiRes::time();
+       } while $t1 - $t0 <= 0.3;
+       print "# t0 = $t0\n# t1 = $t1\n# t1 - t0 = ", ($t1 - $t0), "\n";
+
+       $got = Time::HiRes::ualarm(0);
+       ok(46, $got > 0 && $got < 300_000, $got);
+
+       ok(47, $alrm == 0, $alrm);
+
+       $got = Time::HiRes::ualarm(0);
+       ok(48, $got == 0, $got);
+    }
 }
 
 END {

--
Perl5 Master Repository

Reply via email to