From 9b5d724cad10087e34165199e55f15f2df744ed5 Mon Sep 17 00:00:00 2001 From: Dag-Erling Smørgrav Date: Thu, 24 Aug 2023 21:31:11 +0000 Subject: libc: Add timespec_getres(3) as per C23. This also adds support for TIME_MONOTONIC to timespec_get(3). Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D41524 --- include/time.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/time.h b/include/time.h index c6c083316423..ef55577a2f84 100644 --- a/include/time.h +++ b/include/time.h @@ -182,9 +182,15 @@ time_t posix2time(time_t t); #if defined(__BSD_VISIBLE) || __ISO_C_VISIBLE >= 2011 || \ (defined(__cplusplus) && __cplusplus >= 201703) #include -/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */ +/* ISO/IEC 9899:2011 7.27.2.5 The timespec_get function */ #define TIME_UTC 1 /* time elapsed since epoch */ int timespec_get(struct timespec *ts, int base); +#if defined (__BSD_VISIBLE) || __ISO_C_VISIBLE >= 2023 +/* ISO/IEC 9899:2024 7.29.1 Components of time */ +#define TIME_MONOTONIC 2 /* monotonic time */ +/* ISO/IEC 9899:2024 7.29.2.7 The timespec_getres function */ +int timespec_getres(struct timespec *, int); +#endif #endif __END_DECLS -- cgit v1.3