#ifdef HAS_GETTIMEOFDAY
-static void
+static int
myU2time(UV *ret)
{
struct timeval Tp;
status = gettimeofday (&Tp, NULL);
ret[0] = Tp.tv_sec;
ret[1] = Tp.tv_usec;
+ return status;
}
static NV
struct timeval Tp;
int status;
status = gettimeofday (&Tp, NULL);
- return Tp.tv_sec + (Tp.tv_usec / 1000000.);
+ return status == 0 ? Tp.tv_sec + (Tp.tv_usec / 1000000.) : -1.0;
}
#endif
BOOT:
#ifdef HAS_GETTIMEOFDAY
- hv_store(PL_modglobal, "Time::NVtime", 12, newSViv((IV) myNVtime ()), 0);
- hv_store(PL_modglobal, "Time::U2time", 12, newSViv((IV) myU2time ()), 0);
+{
+ UV auv[2];
+ hv_store(PL_modglobal, "Time::NVtime", 12, newSViv((IV) myNVtime()), 0);
+ if (myU2time(auv) == 0)
+ hv_store(PL_modglobal, "Time::U2time", 12, newSViv((IV) auv[0]), 0);
+}
#endif
IV