libc/time: Add C23 timespec_getres() and timegm()

Message ID 20260706023027.28665-1-sebastian.huber@embedded-brains.de
State New
Headers
Series libc/time: Add C23 timespec_getres() and timegm() |

Commit Message

Sebastian Huber July 6, 2026, 2:30 a.m. UTC
  Add also TIME_MONOTONIC. These interfaces are defined in the C23
standard.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/include/time.h | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

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);
 
 int        timespec_get(struct timespec *ts, int base);
 #endif
+#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 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);