2 * ntp_unixtime.h - much of what was here is now in timevalops.h
8 #include "ntp_types.h" /* picks up time.h via ntp_machine.h */
9 #include "ntp_calendar.h"
12 # define GETTIMEOFDAY(a, b) (node_gettime(&ntp_node, a))
13 # define SETTIMEOFDAY(a, b) (node_settime(&ntp_node, a))
14 # define ADJTIMEOFDAY(a, b) (node_adjtime(&ntp_node, a, b))
16 # define ADJTIMEOFDAY(a, b) (adjtime(a, b))
17 /* gettimeofday() takes two args in BSD and only one in SYSV */
18 # if defined(HAVE_SYS_TIMERS_H) && defined(HAVE_GETCLOCK)
19 # include <sys/timers.h>
20 int getclock (int clock_type, struct timespec *tp);
21 # define GETTIMEOFDAY(a, b) (gettimeofday(a, b))
22 # define SETTIMEOFDAY(a, b) (settimeofday(a, b))
23 # else /* not (HAVE_SYS_TIMERS_H && HAVE_GETCLOCK) */
24 # ifdef SYSV_TIMEOFDAY
25 # define GETTIMEOFDAY(a, b) (gettimeofday(a))
26 # define SETTIMEOFDAY(a, b) (settimeofday(a))
27 # else /* ! SYSV_TIMEOFDAY */
28 #if defined SYS_CYGWIN32
29 # define GETTIMEOFDAY(a, b) (gettimeofday(a, b))
30 # define SETTIMEOFDAY(a, b) (settimeofday_NT(a))
32 # define GETTIMEOFDAY(a, b) (gettimeofday(a, b))
33 # define SETTIMEOFDAY(a, b) (settimeofday(a, b))
35 # endif /* SYSV_TIMEOFDAY */
36 # endif /* not (HAVE_SYS_TIMERS_H && HAVE_GETCLOCK) */
40 * Time of day conversion constant. Ntp's time scale starts in 1900,
41 * Unix in 1970. The value is 1970 - 1900 in seconds, 0x83aa7e80 or
42 * 2208988800. This is larger than 32-bit INT_MAX, so unsigned
45 #define JAN_1970 ((u_int)NTP_TO_UNIX_DAYS * (u_int)SECSPERDAY)
47 #endif /* !defined(NTP_UNIXTIME_H) */