gavl

clock_nanosleep.h
1#ifndef GAVL_CLOCK_NANOSLEEP_H_INCLUDED
2#define GAVL_CLOCK_NANOSLEEP_H_INCLUDED
3
4#include <time.h>
5#include <unistd.h>
6
7#ifdef __APPLE__
8// macOS <10.12 doesn't have clockid_t / CLOCK_MONOTONIC
9#ifndef CLOCK_MONOTONIC
10 typedef int clockid_t;
11#define CLOCK_MONOTONIC 0
12#endif
13// macOS doesn't have clock_nanosleep
14 static inline
15 int clock_nanosleep(clockid_t clock_id, int flags,
16 const struct timespec *tm, struct timespec *rem)
17{
18 (void) clock_id;
19 (void) flags;
20 (void) tm;
21 (void) rem;
22 errno = ENOSYS;
23 return -1;
24}
25#endif // __APPLE__
26
27#endif // GAVL_CLOCK_NANOSLEEP_H_INCLUDED