Re: Building newlib with clock_gettime()

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCVAQwbZYuRtmM8T_iNHEgfrzJSdsRPLxKgB42Qnr6zPQw@mail.gmail.com>
On Sun, Jan 12, 2025, 6:26 PM Keith Thompson <[email protected]>
wrote:

> > Newlib does not provide an implementation for clock_gettime().
>
> I see an implementation of clock_gettime() in the newlib sources:
>
>
> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/times.cc;h=a89980d08f9b9bf6755de833666f8b204cabbcd8;hb=HEAD#l459
>
> And I'm able to use clock_gettime() on Cygwin.
>

That implementation is in a Cygwin specific directory and is specific to
Cygwin. Other environments that have support for it include it in their own
source. The one for RTEMS is here:

https://gitlab.rtems.org/rtems/rtos/rtems/-/blame/main/cpukit/posix/src/clockgettime.c?ref_type=heads#L51


> Am I missing something?
>

You need to have an implementation specific to your environment.

--joel

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