Change 12594 by jhi@alpha on 2001/10/22 21:23:15

        MacOS Classic timeofday(), from Chris Nandor. 

Affected files ...

... //depot/perl/ext/Time/HiRes/HiRes.xs#18 edit

Differences ...

==== //depot/perl/ext/Time/HiRes/HiRes.xs#18 (text) ====
Index: perl/ext/Time/HiRes/HiRes.xs
--- perl/ext/Time/HiRes/HiRes.xs.~1~    Mon Oct 22 15:30:06 2001
+++ perl/ext/Time/HiRes/HiRes.xs        Mon Oct 22 15:30:06 2001
@@ -442,7 +442,41 @@
 #endif
 
 #ifdef HAS_GETTIMEOFDAY
+#    ifdef MACOS_TRADITIONAL   /* fix epoch TZ and use unsigned time_t */
+void
+gettimeofday()
+        PREINIT:
+        struct timeval Tp;
+        struct timezone Tz;
+        PPCODE:
+        int status;
+        status = gettimeofday (&Tp, &Tz);
+        Tp.tv_sec += Tz.tz_minuteswest * 60;   /* adjust for TZ */
 
+        if (GIMME == G_ARRAY) {
+             EXTEND(sp, 2);
+             /* Mac OS (Classic) has unsigned time_t */
+             PUSHs(sv_2mortal(newSVuv(Tp.tv_sec)));
+             PUSHs(sv_2mortal(newSViv(Tp.tv_usec)));
+        } else {
+             EXTEND(sp, 1);
+             PUSHs(sv_2mortal(newSVnv(Tp.tv_sec + (Tp.tv_usec / 1000000.0))));
+        }
+
+NV
+time()
+        PREINIT:
+        struct timeval Tp;
+        struct timezone Tz;
+        CODE:
+        int status;
+        status = gettimeofday (&Tp, &Tz);
+        Tp.tv_sec += Tz.tz_minuteswest * 60;   /* adjust for TZ */
+        RETVAL = Tp.tv_sec + (Tp.tv_usec / 1000000.0);
+       OUTPUT:
+       RETVAL
+
+#    else      /* MACOS_TRADITIONAL */
 void
 gettimeofday()
         PREINIT:
@@ -470,6 +504,7 @@
        OUTPUT:
        RETVAL
 
+#    endif     /* MACOS_TRADITIONAL */
 #endif
 
 #if defined(HAS_GETITIMER) && defined(HAS_SETITIMER)
End of Patch.

Reply via email to