forked from flightaware/dump1090
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compat.h
63 lines (47 loc) · 1.07 KB
/
compat.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef COMPAT_UTIL_H
#define COMPAT_UTIL_H
/*
* Platform-specific bits
*/
#if defined(__APPLE__)
/*
* Mach endian conversion
*/
# include <libkern/OSByteOrder.h>
# define bswap_16 OSSwapInt16
# define bswap_32 OSSwapInt32
# define bswap_64 OSSwapInt64
# include <machine/endian.h>
# define le16toh(x) OSSwapLittleToHostInt16(x)
# define le32toh(x) OSSwapLittleToHostInt32(x)
# define le64toh(x) OSSwapLittleToHostInt64(x)
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#else // other platforms
# include <endian.h>
#endif
/* clock_* and time-related types */
#include <time.h>
#if defined(CLOCK_REALTIME)
# define HAVE_CLOCKID_T
#endif
#ifndef HAVE_CLOCKID_T
typedef enum
{
CLOCK_REALTIME,
CLOCK_MONOTONIC,
CLOCK_PROCESS_CPUTIME_ID,
CLOCK_THREAD_CPUTIME_ID
} clockid_t;
#endif // !HAVE_CLOCKID_T
#ifndef TIMER_ABSTIME
#define TIMER_ABSTIME 1
#endif // !TIMER_ABSTIME
struct timespec;
#ifdef MISSING_NANOSLEEP
#include "clock_nanosleep/clock_nanosleep.h"
#endif
#ifdef MISSING_GETTIME
#include "clock_gettime/clock_gettime.h"
#endif
#endif //COMPAT_UTIL_H