C11 timespec_get(), TIME_UTC

Falco Girgis <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAB4=puLVf1WMraT9OpgvHyTnkCZJpovHE=Qy2ONn+OskO+FX5g@mail.gmail.com>
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?

Anyway, thanks again, sorry for the verbosity.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.