summaryrefslogtreecommitdiffstats
path: root/build
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
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')
-rw-r--r--build/has/timer-create.c9
-rw-r--r--build/header.mk1
2 files changed, 10 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);
+}
diff --git a/build/header.mk b/build/header.mk
index abec00f..88a8986 100644
--- a/build/header.mk
+++ b/build/header.mk
@@ -52,6 +52,7 @@ HEADERS := \
gen/has/strtofflags.h \
gen/has/tcgetwinsize.h \
gen/has/timegm.h \
+ gen/has/timer-create.h \
gen/has/tm-gmtoff.h \
gen/has/uselocale.h