4 #define PERL_NO_GET_CONTEXT
8 #if defined(__CYGWIN__) && defined(HAS_W32API_WINDOWS_H)
9 # include <w32api/windows.h>
10 # define CYGWIN_WITH_W32API
15 # include <sys/time.h>
19 # include <sys/select.h>
30 # define dNOOP extern int Perl___notused
41 # define MY_CXT_CLONE \
43 my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
44 Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t); \
45 sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
48 # define START_MY_CXT static my_cxt_t my_cxt;
49 # define dMY_CXT dNOOP
50 # define MY_CXT_INIT NOOP
51 # define MY_CXT_CLONE NOOP
52 # define MY_CXT my_cxt
56 # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
57 # define NVTYPE long double
59 # define NVTYPE double
66 # if IVSIZE == LONGSIZE
70 # if IVSIZE == INTSIZE
82 # if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
83 defined(PERL_PRIgldbl) /* Not very likely, but let's try anyway. */
84 # define NVgf PERL_PRIgldbl
92 #if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
94 # define INT2PTR(any,d) (any)(d)
96 # if PTRSIZE == LONGSIZE
97 # define PTRV unsigned long
99 # define PTRV unsigned
101 # define INT2PTR(any,d) (any)(PTRV)(d)
103 #define PTR2IV(p) INT2PTR(IV,p)
105 #endif /* !INT2PTR */
109 sv_2pv_nolen(pTHX_ register SV *sv)
112 return sv_2pv(sv, &n_a);
114 # define SvPV_nolen(sv) \
115 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
116 ? SvPVX(sv) : sv_2pv_nolen(sv))
119 #ifndef PerlProc_pause
120 # define PerlProc_pause() Pause()
123 /* Though the cpp define ITIMER_VIRTUAL is available the functionality
124 * is not supported in Cygwin as of August 2004, ditto for Win32.
125 * Neither are ITIMER_PROF or ITIMER_REALPROF implemented. --jhi
127 #if defined(__CYGWIN__) || defined(WIN32)
128 # undef ITIMER_VIRTUAL
130 # undef ITIMER_REALPROF
133 /* 5.004 doesn't define PL_sv_undef */
134 #ifndef ATLEASTFIVEOHOHFIVE
136 # define PL_sv_undef sv_undef
140 #include "const-c.inc"
142 #if defined(WIN32) || defined(CYGWIN_WITH_W32API)
144 #ifndef HAS_GETTIMEOFDAY
145 # define HAS_GETTIMEOFDAY
148 /* shows up in winsock.h?
156 unsigned __int64 ft_i64;
160 #define MY_CXT_KEY "Time::HiRes_" XS_VERSION
163 unsigned long run_count;
164 unsigned __int64 base_ticks;
165 unsigned __int64 tick_frequency;
166 FT_t base_systime_as_filetime;
167 unsigned __int64 reset_time;
172 /* Number of 100 nanosecond units from 1/1/1601 to 1/1/1970 */
174 # define Const64(x) x##LL
176 # define Const64(x) x##i64
178 #define EPOCH_BIAS Const64(116444736000000000)
180 /* NOTE: This does not compute the timezone info (doing so can be expensive,
181 * and appears to be unsupported even by glibc) */
183 /* dMY_CXT needs a Perl context and we don't want to call PERL_GET_CONTEXT
184 for performance reasons */
187 #define gettimeofday(tp, not_used) _gettimeofday(aTHX_ tp, not_used)
189 /* If the performance counter delta drifts more than 0.5 seconds from the
190 * system time then we recalibrate to the system time. This means we may
191 * move *backwards* in time! */
192 #define MAX_PERF_COUNTER_SKEW Const64(5000000) /* 0.5 seconds */
194 /* Reset reading from the performance counter every five minutes.
195 * Many PC clocks just seem to be so bad. */
196 #define MAX_PERF_COUNTER_TICKS Const64(300000000) /* 300 seconds */
199 _gettimeofday(pTHX_ struct timeval *tp, void *not_used)
203 unsigned __int64 ticks;
206 if (MY_CXT.run_count++ == 0 ||
207 MY_CXT.base_systime_as_filetime.ft_i64 > MY_CXT.reset_time) {
208 QueryPerformanceFrequency((LARGE_INTEGER*)&MY_CXT.tick_frequency);
209 QueryPerformanceCounter((LARGE_INTEGER*)&MY_CXT.base_ticks);
210 GetSystemTimeAsFileTime(&MY_CXT.base_systime_as_filetime.ft_val);
211 ft.ft_i64 = MY_CXT.base_systime_as_filetime.ft_i64;
212 MY_CXT.reset_time = ft.ft_i64 + MAX_PERF_COUNTER_TICKS;
216 QueryPerformanceCounter((LARGE_INTEGER*)&ticks);
217 ticks -= MY_CXT.base_ticks;
218 ft.ft_i64 = MY_CXT.base_systime_as_filetime.ft_i64
219 + Const64(10000000) * (ticks / MY_CXT.tick_frequency)
220 +(Const64(10000000) * (ticks % MY_CXT.tick_frequency)) / MY_CXT.tick_frequency;
221 diff = ft.ft_i64 - MY_CXT.base_systime_as_filetime.ft_i64;
222 if (diff < -MAX_PERF_COUNTER_SKEW || diff > MAX_PERF_COUNTER_SKEW) {
223 MY_CXT.base_ticks += ticks;
224 GetSystemTimeAsFileTime(&MY_CXT.base_systime_as_filetime.ft_val);
225 ft.ft_i64 = MY_CXT.base_systime_as_filetime.ft_i64;
229 /* seconds since epoch */
230 tp->tv_sec = (long)((ft.ft_i64 - EPOCH_BIAS) / Const64(10000000));
232 /* microseconds remaining */
233 tp->tv_usec = (long)((ft.ft_i64 / Const64(10)) % Const64(1000000));
239 #if defined(WIN32) && !defined(ATLEASTFIVEOHOHFIVE)
241 sleep(unsigned int t)
248 #if !defined(HAS_GETTIMEOFDAY) && defined(VMS)
249 #define HAS_GETTIMEOFDAY
252 #include <time.h> /* gettimeofday */
253 #include <stdlib.h> /* qdiv */
254 #include <starlet.h> /* sys$gettim */
257 #include <lib$routines.h> /* lib$ediv() */
261 VMS binary time is expressed in 100 nano-seconds since
262 system base time which is 17-NOV-1858 00:00:00.00
265 #define DIV_100NS_TO_SECS 10000000L
266 #define DIV_100NS_TO_USECS 10L
269 gettimeofday is supposed to return times since the epoch
270 so need to determine this in terms of VMS base time
272 static $DESCRIPTOR(dscepoch,"01-JAN-1970 00:00:00.00");
275 static long base_adjust[2]={0L,0L};
277 static __int64 base_adjust=0;
282 If we don't have gettimeofday, then likely we are on a VMS machine that
283 operates on local time rather than UTC...so we have to zone-adjust.
284 This code gleefully swiped from VMS.C
287 /* method used to handle UTC conversions:
288 * 1 == CRTL gmtime(); 2 == SYS$TIMEZONE_DIFFERENTIAL; 3 == no correction
290 static int gmtime_emulation_type;
291 /* number of secs to add to UTC POSIX-style time to get local time */
292 static long int utc_offset_secs;
293 static struct dsc$descriptor_s fildevdsc =
294 { 12, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$FILE_DEV" };
295 static struct dsc$descriptor_s *fildev[] = { &fildevdsc, NULL };
297 static time_t toutc_dst(time_t loc) {
300 if ((rsltmp = localtime(&loc)) == NULL) return -1;
301 loc -= utc_offset_secs;
302 if (rsltmp->tm_isdst) loc -= 3600;
306 static time_t toloc_dst(time_t utc) {
309 utc += utc_offset_secs;
310 if ((rsltmp = localtime(&utc)) == NULL) return -1;
311 if (rsltmp->tm_isdst) utc += 3600;
315 #define _toutc(secs) ((secs) == (time_t) -1 ? (time_t) -1 : \
316 ((gmtime_emulation_type || timezone_setup()), \
317 (gmtime_emulation_type == 1 ? toutc_dst(secs) : \
318 ((secs) - utc_offset_secs))))
320 #define _toloc(secs) ((secs) == (time_t) -1 ? (time_t) -1 : \
321 ((gmtime_emulation_type || timezone_setup()), \
322 (gmtime_emulation_type == 1 ? toloc_dst(secs) : \
323 ((secs) + utc_offset_secs))))
330 if (gmtime_emulation_type == 0) {
332 time_t base = 15 * 86400; /* 15jan71; to avoid month/year ends between */
333 /* results of calls to gmtime() and localtime() */
336 gmtime_emulation_type++;
337 if ((tm_p = gmtime(&base)) == NULL) { /* CRTL gmtime() is a fake */
338 char off[LNM$C_NAMLENGTH+1];;
340 gmtime_emulation_type++;
341 if (!Perl_vmstrnenv("SYS$TIMEZONE_DIFFERENTIAL",off,0,fildev,0)) {
342 gmtime_emulation_type++;
344 Perl_warn(aTHX_ "no UTC offset information; assuming local time is UTC");
346 else { utc_offset_secs = atol(off); }
348 else { /* We've got a working gmtime() */
349 struct tm gmt, local;
352 tm_p = localtime(&base);
354 utc_offset_secs = (local.tm_mday - gmt.tm_mday) * 86400;
355 utc_offset_secs += (local.tm_hour - gmt.tm_hour) * 3600;
356 utc_offset_secs += (local.tm_min - gmt.tm_min) * 60;
357 utc_offset_secs += (local.tm_sec - gmt.tm_sec);
365 gettimeofday (struct timeval *tp, void *tpz)
371 long div_100ns_to_secs;
372 long div_100ns_to_usecs;
380 In case of error, tv_usec = 0 and tv_sec = VMS condition code.
381 The return from function is also set to -1.
382 This is not exactly as per the manual page.
388 if (base_adjust[0]==0 && base_adjust[1]==0) {
390 if (base_adjust==0) { /* Need to determine epoch adjustment */
392 ret=sys$bintim(&dscepoch,&base_adjust);
393 if (1 != (ret &&1)) {
399 ret=sys$gettim(&quad); /* Get VMS system time */
400 if ((1 && ret) == 1) {
402 quad[0] -= base_adjust[0]; /* convert to epoch offset */
403 quad[1] -= base_adjust[1]; /* convert 2nd half of quadword */
404 div_100ns_to_secs = DIV_100NS_TO_SECS;
405 div_100ns_to_usecs = DIV_100NS_TO_USECS;
406 lib$ediv(&div_100ns_to_secs,&quad,&quo,&rem);
409 lib$ediv(&div_100ns_to_usecs,&quad1,&quo1,&rem1);
410 tp->tv_sec = quo; /* Whole seconds */
411 tp->tv_usec = quo1; /* Micro-seconds */
413 quad -= base_adjust; /* convert to epoch offset */
414 ans1=qdiv(quad,DIV_100NS_TO_SECS);
415 ans2=qdiv(ans1.rem,DIV_100NS_TO_USECS);
416 tp->tv_sec = ans1.quot; /* Whole seconds */
417 tp->tv_usec = ans2.quot; /* Micro-seconds */
425 if (VMSISH_TIME) tp->tv_sec = _toloc(tp->tv_sec);
427 if (!VMSISH_TIME) tp->tv_sec = _toutc(tp->tv_sec);
435 /* Do not use H A S _ N A N O S L E E P
436 * so that Perl Configure doesn't scan for it.
437 * The TIME_HIRES_NANOSLEEP is set by Makefile.PL. */
438 #if !defined(HAS_USLEEP) && defined(TIME_HIRES_NANOSLEEP)
440 #define usleep hrt_nanosleep /* could conflict with ncurses for static build */
443 hrt_nanosleep(unsigned long usec)
446 res.tv_sec = usec/1000/1000;
447 res.tv_nsec = ( usec - res.tv_sec*1000*1000 ) * 1000;
448 nanosleep(&res, NULL);
453 #if !defined(HAS_USLEEP) && defined(HAS_SELECT)
454 #ifndef SELECT_IS_BROKEN
456 #define usleep hrt_usleep /* could conflict with ncurses for static build */
459 hrt_usleep(unsigned long usec)
464 select(0, (Select_fd_set_t)NULL, (Select_fd_set_t)NULL,
465 (Select_fd_set_t)NULL, &tv);
470 #if !defined(HAS_USLEEP) && defined(WIN32)
472 #define usleep hrt_usleep /* could conflict with ncurses for static build */
475 hrt_usleep(unsigned long usec)
484 #if !defined(HAS_UALARM) && defined(HAS_SETITIMER)
486 #define ualarm hrt_ualarm /* could conflict with ncurses for static build */
489 hrt_ualarm(int usec, int interval)
491 struct itimerval itv;
492 itv.it_value.tv_sec = usec / 1000000;
493 itv.it_value.tv_usec = usec % 1000000;
494 itv.it_interval.tv_sec = interval / 1000000;
495 itv.it_interval.tv_usec = interval % 1000000;
496 return setitimer(ITIMER_REAL, &itv, 0);
500 #if !defined(HAS_UALARM) && defined(VMS)
502 #define ualarm vms_ualarm
504 #include <lib$routines.h>
512 #define VMSERR(s) (!((s)&1))
515 us_to_VMS(useconds_t mseconds, unsigned long v[])
524 iss = lib$addx(qq,qq,qq);
525 if (VMSERR(iss)) lib$signal(iss);
526 iss = lib$subx(v,qq,v);
527 if (VMSERR(iss)) lib$signal(iss);
528 iss = lib$addx(qq,qq,qq);
529 if (VMSERR(iss)) lib$signal(iss);
530 iss = lib$subx(v,qq,v);
531 if (VMSERR(iss)) lib$signal(iss);
532 iss = lib$subx(v,qq,v);
533 if (VMSERR(iss)) lib$signal(iss);
537 VMS_to_us(unsigned long v[])
540 unsigned long div=10,quot, rem;
542 iss = lib$ediv(&div,v,",&rem);
543 if (VMSERR(iss)) lib$signal(iss);
548 typedef unsigned short word;
549 typedef struct _ualarm {
552 unsigned long delay[2];
553 unsigned long interval[2];
554 unsigned long remain[2];
559 static Alarm *a0, alarm_base;
564 static void ualarm_AST(Alarm *a);
567 vms_ualarm(int mseconds, int interval)
576 static struct item_list3 itmlst[2];
577 static int first = 1;
583 itmlst[0].code = JPI$_ASTEN;
584 itmlst[0].length = sizeof(asten);
585 itmlst[0].retlenaddr = NULL;
587 itmlst[1].length = 0;
588 itmlst[1].bufaddr = NULL;
589 itmlst[1].retlenaddr = NULL;
591 iss = lib$get_ef(&alarm_ef);
592 if (VMSERR(iss)) lib$signal(iss);
595 a0->function = UAL_NULL;
597 itmlst[0].bufaddr = &asten;
599 iss = sys$getjpiw(0,0,0,itmlst,0,0,0);
600 if (VMSERR(iss)) lib$signal(iss);
601 if (!(asten&0x08)) return -1;
605 a->function = UAL_SET;
607 a->function = UAL_CLEAR;
610 us_to_VMS(mseconds, a->delay);
612 us_to_VMS(interval, a->interval);
617 iss = sys$clref(alarm_ef);
618 if (VMSERR(iss)) lib$signal(iss);
620 iss = sys$dclast(ualarm_AST,a,0);
621 if (VMSERR(iss)) lib$signal(iss);
623 iss = sys$waitfr(alarm_ef);
624 if (VMSERR(iss)) lib$signal(iss);
626 if (a->function == UAL_ACTIVE)
627 return VMS_to_us(a->remain);
638 unsigned long now[2];
640 iss = sys$gettim(now);
641 if (VMSERR(iss)) lib$signal(iss);
643 if (a->function == UAL_SET || a->function == UAL_CLEAR) {
644 if (a0->function == UAL_ACTIVE) {
645 iss = sys$cantim(a0,PSL$C_USER);
646 if (VMSERR(iss)) lib$signal(iss);
648 iss = lib$subx(a0->remain, now, a->remain);
649 if (VMSERR(iss)) lib$signal(iss);
651 if (a->remain[1] & 0x80000000)
652 a->remain[0] = a->remain[1] = 0;
655 if (a->function == UAL_SET) {
656 a->function = a0->function;
657 a0->function = UAL_ACTIVE;
658 a0->repeat = a->repeat;
660 a0->interval[0] = a->interval[0];
661 a0->interval[1] = a->interval[1];
663 a0->delay[0] = a->delay[0];
664 a0->delay[1] = a->delay[1];
666 iss = lib$subx(now, a0->delay, a0->remain);
667 if (VMSERR(iss)) lib$signal(iss);
669 iss = sys$setimr(0,a0->delay,ualarm_AST,a0);
670 if (VMSERR(iss)) lib$signal(iss);
672 a->function = a0->function;
673 a0->function = UAL_NULL;
675 iss = sys$setef(alarm_ef);
676 if (VMSERR(iss)) lib$signal(iss);
677 } else if (a->function == UAL_ACTIVE) {
679 iss = lib$subx(now, a->interval, a->remain);
680 if (VMSERR(iss)) lib$signal(iss);
682 iss = sys$setimr(0,a->interval,ualarm_AST,a);
683 if (VMSERR(iss)) lib$signal(iss);
685 a->function = UAL_NULL;
688 if (VMSERR(iss)) lib$signal(iss);
689 lib$signal(SS$_ASTFLT);
691 lib$signal(SS$_BADPARAM);
695 #endif /* !HAS_UALARM && VMS */
697 #ifdef HAS_GETTIMEOFDAY
700 myU2time(pTHX_ UV *ret)
704 status = gettimeofday (&Tp, NULL);
718 status = gettimeofday (&Tp, NULL);
719 return status == 0 ? Tp.tv_sec + (Tp.tv_usec / 1000000.) : -1.0;
724 MODULE = Time::HiRes PACKAGE = Time::HiRes
733 #ifdef ATLEASTFIVEOHOHFIVE
734 #ifdef HAS_GETTIMEOFDAY
737 hv_store(PL_modglobal, "Time::NVtime", 12, newSViv(PTR2IV(myNVtime)), 0);
738 if (myU2time(aTHX_ auv) == 0)
739 hv_store(PL_modglobal, "Time::U2time", 12, newSViv((IV) auv[0]), 0);
745 #if defined(USE_ITHREADS) && defined(MY_CXT_KEY)
754 INCLUDE: const-xs.inc
756 #if defined(HAS_USLEEP) && defined(HAS_GETTIMEOFDAY)
762 struct timeval Ta, Tb;
764 gettimeofday(&Ta, NULL);
766 if (useconds > 1E6) {
767 IV seconds = (IV) (useconds / 1E6);
768 /* If usleep() has been implemented using setitimer()
769 * then this contortion is unnecessary-- but usleep()
770 * may be implemented in some other way, so let's contort. */
773 useconds -= 1E6 * seconds;
775 } else if (useconds < 0.0)
776 croak("Time::HiRes::usleep(%"NVgf"): negative time not invented yet", useconds);
777 usleep((U32)useconds);
780 gettimeofday(&Tb, NULL);
782 printf("[%ld %ld] [%ld %ld]\n", Tb.tv_sec, Tb.tv_usec, Ta.tv_sec, Ta.tv_usec);
784 RETVAL = 1E6*(Tb.tv_sec-Ta.tv_sec)+(NV)((IV)Tb.tv_usec-(IV)Ta.tv_usec);
792 struct timeval Ta, Tb;
794 gettimeofday(&Ta, NULL);
796 NV seconds = SvNV(ST(0));
797 if (seconds >= 0.0) {
798 UV useconds = (UV)(1E6 * (seconds - (UV)seconds));
801 if ((IV)useconds < 0) {
802 #if defined(__sparc64__) && defined(__GNUC__)
803 /* Sparc64 gcc 2.95.3 (e.g. on NetBSD) has a bug
804 * where (0.5 - (UV)(0.5)) will under certain
805 * circumstances (if the double is cast to UV more
806 * than once?) evaluate to -0.5, instead of 0.5. */
807 useconds = -(IV)useconds;
809 if ((IV)useconds < 0)
810 croak("Time::HiRes::sleep(%"NVgf"): internal error: useconds < 0 (unsigned %"UVuf" signed %"IVdf")", seconds, useconds, (IV)useconds);
814 croak("Time::HiRes::sleep(%"NVgf"): negative time not invented yet", seconds);
817 gettimeofday(&Tb, NULL);
819 printf("[%ld %ld] [%ld %ld]\n", Tb.tv_sec, Tb.tv_usec, Ta.tv_sec, Ta.tv_usec);
821 RETVAL = (NV)(Tb.tv_sec-Ta.tv_sec)+0.000001*(NV)(Tb.tv_usec-Ta.tv_usec);
831 ualarm(useconds,interval=0)
835 if (useconds < 0 || interval < 0)
836 croak("Time::HiRes::ualarm(%d, %d): negative time not invented yet", useconds, interval);
837 RETVAL = ualarm(useconds, interval);
843 alarm(seconds,interval=0)
847 if (seconds < 0.0 || interval < 0.0)
848 croak("Time::HiRes::alarm(%"NVgf", %"NVgf"): negative time not invented yet", seconds, interval);
849 RETVAL = (NV)ualarm(seconds * 1000000,
850 interval * 1000000) / 1E6;
857 #ifdef HAS_GETTIMEOFDAY
858 # ifdef MACOS_TRADITIONAL /* fix epoch TZ and use unsigned time_t */
866 status = gettimeofday (&Tp, &Tz);
867 Tp.tv_sec += Tz.tz_minuteswest * 60; /* adjust for TZ */
869 if (GIMME == G_ARRAY) {
871 /* Mac OS (Classic) has unsigned time_t */
872 PUSHs(sv_2mortal(newSVuv(Tp.tv_sec)));
873 PUSHs(sv_2mortal(newSViv(Tp.tv_usec)));
876 PUSHs(sv_2mortal(newSVnv(Tp.tv_sec + (Tp.tv_usec / 1000000.0))));
886 status = gettimeofday (&Tp, &Tz);
887 Tp.tv_sec += Tz.tz_minuteswest * 60; /* adjust for TZ */
888 RETVAL = Tp.tv_sec + (Tp.tv_usec / 1000000.0);
892 # else /* MACOS_TRADITIONAL */
899 status = gettimeofday (&Tp, NULL);
900 if (GIMME == G_ARRAY) {
902 PUSHs(sv_2mortal(newSViv(Tp.tv_sec)));
903 PUSHs(sv_2mortal(newSViv(Tp.tv_usec)));
906 PUSHs(sv_2mortal(newSVnv(Tp.tv_sec + (Tp.tv_usec / 1000000.0))));
915 status = gettimeofday (&Tp, NULL);
916 RETVAL = Tp.tv_sec + (Tp.tv_usec / 1000000.);
920 # endif /* MACOS_TRADITIONAL */
923 #if defined(HAS_GETITIMER) && defined(HAS_SETITIMER)
925 #define TV2NV(tv) ((NV)((tv).tv_sec) + 0.000001 * (NV)((tv).tv_usec))
928 setitimer(which, seconds, interval = 0)
933 struct itimerval newit;
934 struct itimerval oldit;
936 if (seconds < 0.0 || interval < 0.0)
937 croak("Time::HiRes::setitimer(%"IVdf", %"NVgf", %"NVgf"): negative time not invented yet", (IV)which, seconds, interval);
938 newit.it_value.tv_sec = seconds;
939 newit.it_value.tv_usec =
940 (seconds - (NV)newit.it_value.tv_sec) * 1000000.0;
941 newit.it_interval.tv_sec = interval;
942 newit.it_interval.tv_usec =
943 (interval - (NV)newit.it_interval.tv_sec) * 1000000.0;
944 if (setitimer(which, &newit, &oldit) == 0) {
946 PUSHs(sv_2mortal(newSVnv(TV2NV(oldit.it_value))));
947 if (GIMME == G_ARRAY) {
949 PUSHs(sv_2mortal(newSVnv(TV2NV(oldit.it_interval))));
957 struct itimerval nowit;
959 if (getitimer(which, &nowit) == 0) {
961 PUSHs(sv_2mortal(newSVnv(TV2NV(nowit.it_value))));
962 if (GIMME == G_ARRAY) {
964 PUSHs(sv_2mortal(newSVnv(TV2NV(nowit.it_interval))));