File: ntp_syscall.h

package info (click to toggle)
ntpsec 1.2.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,360 kB
  • sloc: ansic: 62,698; python: 32,477; sh: 1,575; yacc: 1,331; makefile: 193; javascript: 138
file content (33 lines) | stat: -rw-r--r-- 947 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * ntp_syscall.h - various ways to perform the ntp_adjtime() system calls.
 *
 * On most systems including <sys/timex.h> will bring in declarations
 * for the BSD function ntp_adjtime(2). (Linux using glibc has these,
 * though they're not visible in the manual pages.)
 */

#ifndef GUARD_NTP_SYSCALL_H
#define GUARD_NTP_SYSCALL_H

# include <sys/time.h>	/* prerequisite on NetBSD */
# include <sys/timex.h>
extern int ntp_adjtime_ns(struct timex *);

/*
 * The units of the maxerror and esterror fields vary by platform.  If
 * STA_NANO is defined, they're in nanoseconds; otherwise in
 * microseconds. Hide the difference by normalizing everything to
 * float seconds.
 */
# ifdef STA_NANO
#define ntp_error_in_seconds(n)	((n)/1.0e9)
# else
#define ntp_error_in_seconds(n)	((n)/1.0e6)
# endif

/* MUSL port shim */
#if !defined(HAVE_NTP_ADJTIME) && defined(HAVE_ADJTIMEX)
#define ntp_adjtime adjtimex
#endif

#endif	/* GUARD_NTP_SYSCALL_H */