2 static const char rcsid
[] = "$Id: gettimeofday.c,v 1.1.2.2 2002/07/12 00:49:51 marka Exp $";
5 #include "port_before.h"
9 #include "port_after.h"
11 #if !defined(NEED_GETTIMEOFDAY)
13 * gettimeofday() occasionally returns invalid tv_usec on some platforms.
15 #define MILLION 1000000
19 isc__gettimeofday(struct timeval
*tp
, struct timezone
*tzp
) {
22 res
= gettimeofday(tp
, tzp
);
27 if (tp
->tv_usec
< 0) {
29 tp
->tv_usec
+= MILLION
;
31 } while (tp
->tv_usec
< 0);
33 } else if (tp
->tv_usec
> MILLION
) {
35 tp
->tv_usec
-= MILLION
;
37 } while (tp
->tv_usec
> MILLION
);
42 syslog(LOG_ERR
, "gettimeofday: tv_usec out of range\n");
47 gettimeofday(struct timeval
*tvp
, struct _TIMEZONE
*tzp
) {
48 time_t clock
, time(time_t *);
50 if (time(&clock
) == (time_t) -1)
57 tzp
->tz_minuteswest
= 0;
62 #endif /*NEED_GETTIMEOFDAY*/