C11 timespec_get(), TIME_UTC

Joel Sherrill joel@rtems.org
Sat Mar 25 21:21:31 GMT 2023

On Sat, Mar 25, 2023, 4:00 PM Falco Girgis <gyrovorbis@gmail.com> wrote:

> Hey guys,
> I'm a big user and fan of Newlib and have really enjoyed working with it.
> In addition to it being used in a bunch of the builds I target in CI, I'm
> one of the maintainers of the KallistiOS indie/homebrew SDK for the Sega
> Dreamcast, which has an epic amount of modern language and stdlib support
> for C and C++ thanks to you guys.
> Anyway, I just encountered something today that is missing that I can't
> help but feel like should really be included within the lib: support for
> the C11 timespec struct, timespec_get() function, and the TIME_UTC macro,
> used to simply get the current UTC time in seconds + nanoseconds:
> https://en.cppreference.com/w/c/chrono/TIME_UTC
> Given the amount of non-standard POSIX time functionality that is
> supported, the modern C++ chrono stuff, the rest of the C stdlib, etc, it
> feels like this should fall within the scope of the project. It looks like
> everybody else is just doing a tiny little wrapper for it around
> clock_gettime(), so it's simple to implement as well... I also see several
> threads on stack overflow with people confused as to why it's not available
> to them, so I'm not the only one interested.
> I've never submitted a patch for anything like this before and wanted to
> run this by you guys to make sure it fall within NewLib's scope before I
> was going to give it a shot. What do you guys think?

I will go the explanation that hi one had ever wanted it enough to
implement it. :)

Sure feel free to implement and submit it with the proper license.

> Anyway, thanks again, sorry for the verbosity.

More information about the Newlib mailing list