[PATCH] libc/time: Add C23 timespec_getres() and timegm()

Sebastian Huber <[email protected]> Mon, 6 Jul 2026 04:30:27 +0200
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Add also TIME_MONOTONIC. These interfaces are defined in the C23
standard.

Signed-off-by: Sebastian Huber <[email protected]>
---
 newlib/libc/include/time.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
index 58c5066ed..072aca4ef 100644
--- a/newlib/libc/include/time.h
+++ b/newlib/libc/include/time.h
@@ -62,6 +62,11 @@ time_t	   time (time_t *_timer);
=20
 int        timespec_get(struct timespec *ts, int base);
 #endif
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >=3D 2023
+#define TIME_MONOTONIC 2
+int	   timespec_getres(struct timespec *, int);
+time_t	   timegm(struct tm * const);
+#endif
 #ifndef _REENT_ONLY
 char	  *asctime (const struct tm *_tblock);
 char	  *ctime (const time_t *_time);
--=20
2.51.0