diff options
author | Steve Peters <steve@fisharerojo.org> | 2006-10-03 13:08:35 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-10-03 13:08:35 +0000 |
commit | 34f6948355c3813dae85d2f858b544061e7050ab (patch) | |
tree | 21caab7252fae09fd88763cdf0bf30a8687c2ef6 /ext | |
parent | f353a419ab395e938eafc6160a3502642b35d964 (diff) | |
download | perl-34f6948355c3813dae85d2f858b544061e7050ab.tar.gz |
Upgrade to Time-HiRes-1.91
p4raw-id: //depot/perl@28919
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Time/HiRes/Changes | 7 | ||||
-rw-r--r-- | ext/Time/HiRes/HiRes.pm | 8 | ||||
-rw-r--r-- | ext/Time/HiRes/HiRes.xs | 21 |
3 files changed, 29 insertions, 7 deletions
diff --git a/ext/Time/HiRes/Changes b/ext/Time/HiRes/Changes index a357ad6c85..b878c284f5 100644 --- a/ext/Time/HiRes/Changes +++ b/ext/Time/HiRes/Changes @@ -1,5 +1,12 @@ Revision history for Perl extension Time::HiRes. +1.91 [2006-09-28] + - ualarm() in SuSE 10.1 was overflowing after ~4.2 seconds, + probably due to a glibc bug/feature, workaround by using the + setitimer() variant if either useconds or interval >= IV_1E6 + (this case seems to vary between systems: are useconds + more than 999_999 for ualarm() defined or not) + 1.90 [2006-08-22] - tweak still needed for Const64(), from Jerry Hedden - get a freshly generated ppport.h diff --git a/ext/Time/HiRes/HiRes.pm b/ext/Time/HiRes/HiRes.pm index f032d9b4a8..b975262aa6 100644 --- a/ext/Time/HiRes/HiRes.pm +++ b/ext/Time/HiRes/HiRes.pm @@ -21,7 +21,7 @@ require DynaLoader; d_nanosleep d_clock_gettime d_clock_getres d_clock d_clock_nanosleep); -$VERSION = '1.90'; +$VERSION = '1.91'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -449,6 +449,12 @@ Here is an example of using C<NVtime> from C: =head1 DIAGNOSTICS +=head2 useconds or interval more than ... + +In ualarm() you tried to use number of microseconds or interval (also +in microseconds) more than 1_000_000 and setitimer() is not available +in your system to emulate that case. + =head2 negative time not invented yet You tried to use a negative time argument. diff --git a/ext/Time/HiRes/HiRes.xs b/ext/Time/HiRes/HiRes.xs index df0a4360a0..c27c56314b 100644 --- a/ext/Time/HiRes/HiRes.xs +++ b/ext/Time/HiRes/HiRes.xs @@ -468,12 +468,9 @@ hrt_usleep(unsigned long usec) #endif /* #if !defined(HAS_USLEEP) && defined(HAS_POLL) */ -#if !defined(HAS_UALARM) && defined(HAS_SETITIMER) -#define HAS_UALARM -#define ualarm hrt_ualarm /* could conflict with ncurses for static build */ - +#if defined(HAS_SETITIMER) && defined(ITIMER_REAL) int -hrt_ualarm(int usec, int interval) +hrt_ualarm_itimer(int usec, int interval) { struct itimerval itv; itv.it_value.tv_sec = usec / IV_1E6; @@ -484,6 +481,11 @@ hrt_ualarm(int usec, int interval) } #endif /* #if !defined(HAS_UALARM) && defined(HAS_SETITIMER) */ +#if !defined(HAS_UALARM) && defined(HAS_SETITIMER) +#define HAS_UALARM +#define ualarm hrt_ualarm_itimer /* could conflict with ncurses for static build */ +#endif + #if !defined(HAS_UALARM) && defined(VMS) #define HAS_UALARM #define ualarm vms_ualarm @@ -874,7 +876,14 @@ ualarm(useconds,interval=0) CODE: if (useconds < 0 || interval < 0) croak("Time::HiRes::ualarm(%d, %d): negative time not invented yet", useconds, interval); - RETVAL = ualarm(useconds, interval); + if (useconds >= IV_1E6 || interval >= IV_1E6) +#if defined(HAS_SETITIMER) && defined(ITIMER_REAL) + RETVAL = hrt_ualarm_itimer(useconds, interval); +#else + croak("Time::HiRes::ualarm(%d, %d): useconds or interval equal or more than %"IVdf, useconds, interval, IV_1E6); +#endif + else + RETVAL = ualarm(useconds, interval); OUTPUT: RETVAL |