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

Sebastian Huber sebastian.huber@embedded-brains.de
Wed Sep 9 02:29:12 GMT 2026


----- 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?

-- 
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the Newlib mailing list