timegm() and other time related functions
R. Diez
rdiezmail-newlib@yahoo.de
Wed Jan 25 14:23:27 GMT 2023
> while porting nats.c to RTEMS I noticed that Newlib doesn't provide a timegm() function.
> There a couple of related patches and discussions on the Newlib mailing list in the last years.
I tried to contribute an implementation of timegm() to Newlib a while ago, but after the reactions I got in this mailing list, I ended up contributing it to Picolibc instead. Search for timegm here:
https://github.com/picolibc/picolibc/blob/main/newlib/libc/time/mktime.c
This is the first commit:
https://github.com/picolibc/picolibc/commit/1a697a5228a04461066b851dfd96b1ddbbd603fa
And this commit adds the documentation for timegm:
https://github.com/picolibc/picolibc/commit/64d77e6dfefc4cdd40fda477d1d25f7a98d09c16
The affected files may have changed since them, so I would check the latest versions anyway.
I also contributed some tests for timegm. By the way, is the Newlib test suite still broken?
The timegm implementation actually needed little new code, it was basically a small reorganisation of existing Newlib code.
Regards,
R. Diez
More information about the Newlib
mailing list