summaryrefslogtreecommitdiffstats
path: root/build/has/timer-create.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-10-10 10:20:11 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-10-10 11:18:06 -0400
commit881d590d23730fff6bf8f37e10d998226180cd65 (patch)
treedd962f8c2f84d312c845781ddbceb35e23b9b207 /build/has/timer-create.c
parent2889537ee68dacbdd9c8ea4e2053e03e86219c24 (diff)
downloadbfs-881d590d23730fff6bf8f37e10d998226180cd65.tar.xz
xtime: Add a wrapper for timer_create()/setitimer()
setitimer() is obsolescent in POSIX 2008 and removed from POSIX 2024. However, at least macOS doesn't implement the new timer_create() API, so we still need the setitimer() fallback.
Diffstat (limited to 'build/has/timer-create.c')
-rw-r--r--build/has/timer-create.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/build/has/timer-create.c b/build/has/timer-create.c
new file mode 100644
index 0000000..d5354c3
--- /dev/null
+++ b/build/has/timer-create.c
@@ -0,0 +1,9 @@
+// Copyright © Tavian Barnes <tavianator@tavianator.com>
+// SPDX-License-Identifier: 0BSD
+
+#include <time.h>
+
+int main(void) {
+ timer_t timer;
+ return timer_create(CLOCK_REALTIME, NULL, &timer);
+}