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(+)
  

Comments

Sebastian Huber Sept. 9, 2026, 2:29 a.m. UTC | #1
----- Am 6. Jul 2026 um 4:30 schrieb Sebastian Huber sebastian.huber@embedded-brains.de:

> 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(+)
> 
> 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);
> --
> 2.51.0

Any comments with respect to this change?
  

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);