diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2010-06-26 23:30:33 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2010-06-26 23:30:33 +0100 |
commit | 68c5b4dbc1fa93e9864be9a9a2e76bf844b9b783 (patch) | |
tree | b1d15c133ca7593cbc945caa11765b10e6013065 /cpan/Time-HiRes | |
parent | f2ea78b6b778c254e0ec53141eff7044579533fb (diff) | |
download | perl-68c5b4dbc1fa93e9864be9a9a2e76bf844b9b783.tar.gz |
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
Diffstat (limited to 'cpan/Time-HiRes')
-rw-r--r-- | cpan/Time-HiRes/.gitignore | 2 | ||||
-rw-r--r-- | cpan/Time-HiRes/Changes | 10 | ||||
-rw-r--r-- | cpan/Time-HiRes/HiRes.pm | 2 | ||||
-rw-r--r-- | cpan/Time-HiRes/HiRes.xs | 30 | ||||
-rw-r--r-- | cpan/Time-HiRes/Makefile.PL | 2 | ||||
-rw-r--r-- | cpan/Time-HiRes/t/HiRes.t | 51 |
6 files changed, 77 insertions, 20 deletions
diff --git a/cpan/Time-HiRes/.gitignore b/cpan/Time-HiRes/.gitignore deleted file mode 100644 index a89cf3eadf..0000000000 --- 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 ffec191c1e..c365e9924f 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 da4d45a96e..f8ca13dde1 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 69eee69333..1dc2a6829b 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 c44199835f..2b9257af29 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 373c328d0a..0a38e78b04 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 { |