diff options
Diffstat (limited to 'include/hybbx/posix_time.h')
| -rw-r--r-- | include/hybbx/posix_time.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/hybbx/posix_time.h b/include/hybbx/posix_time.h new file mode 100644 index 0000000..6790120 --- /dev/null +++ b/include/hybbx/posix_time.h @@ -0,0 +1,21 @@ +#ifndef HYBBX_POSIX_TIME_H +#define HYBBX_POSIX_TIME_H + +/* + * clock_gettime(CLOCK_MONOTONIC) and usleep() on glibc/Linux (GCC 15+ C99). + * Include before <time.h> / <unistd.h> in .c files, or rely on CMake + * _DEFAULT_SOURCE on Linux builds. + */ +#if defined(__linux__) || defined(__GLIBC__) +#ifndef _DEFAULT_SOURCE +#define _DEFAULT_SOURCE 1 +#endif +#endif + +#include <time.h> + +#if !defined(_WIN32) +#include <unistd.h> +#endif + +#endif /* HYBBX_POSIX_TIME_H */ |
