diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-10-10 10:20:11 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-10-10 11:18:06 -0400 |
commit | 881d590d23730fff6bf8f37e10d998226180cd65 (patch) | |
tree | dd962f8c2f84d312c845781ddbceb35e23b9b207 /src/xtime.h | |
parent | 2889537ee68dacbdd9c8ea4e2053e03e86219c24 (diff) | |
download | bfs-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 'src/xtime.h')
-rw-r--r-- | src/xtime.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/xtime.h b/src/xtime.h index 11f2bf9..2927a2e 100644 --- a/src/xtime.h +++ b/src/xtime.h @@ -46,4 +46,27 @@ int xtimegm(struct tm *tm, time_t *timep); */ int xgetdate(const char *str, struct timespec *result); +/** + * A timer. + */ +struct timer; + +/** + * Start a timer. + * + * @interval + * The regular interval at which to send SIGALRM. + * @return + * The new timer on success, otherwise NULL. + */ +struct timer *xtimer_start(const struct timespec *interval); + +/** + * Stop a timer. + * + * @timer + * The timer to stop. + */ +void xtimer_stop(struct timer *timer); + #endif // BFS_XTIME_H |