summaryrefslogtreecommitdiff
path: root/include/hybbx/posix_time.h
diff options
context:
space:
mode:
authorinfo@mode42.com <info@mode42.com>2026-08-08 03:54:55 +0000
committerinfo@mode42.com <info@mode42.com>2026-08-08 03:54:55 +0000
commit20cb29c2f8c5c87bc590896854a20b1473ceb358 (patch)
tree2857f41513a56ad41af97b57362639298aa7f033 /include/hybbx/posix_time.h
#2
Diffstat (limited to 'include/hybbx/posix_time.h')
-rw-r--r--include/hybbx/posix_time.h21
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 */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com