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