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
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;
=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.
#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;
}
#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
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