Cygwin with clock_gettime and CLOCK_MONOTONIC - gives always 0

Tobias Burnus burnus@net-b.de
Thu Apr 11 19:52:00 GMT 2013


Corinna Vinschen wrote:
> Works fine for me with the current Cygwin 1.7.17, and the upcoming
> Cygwin 1.7.18:
>      if (!clock_gettime (CLOCK_MONOTONIC, &tp))
>        printf ("tv_sec = %ld, tv_nsec = %ld\n", tp.tv_sec, tp.tv_nsec);
...
>    tv_sec = 0, tv_nsec = 29920

Where is actually the source code of the clock_gettime, which Cygwin 
uses? I thought that it was newlib. But looking at
http://sourceware.org/cgi-bin/cvsweb.cgi/src/newlib/libc/sys/linux/clock_gettime.c?cvsroot=src
the code should return -1 for "clock_gettime (CLOCK_MONOTONIC" as 
CLOCK_MONOTONIC (= 4) is not handled, only CLOCK_REALTIME (= 1, 
according to src/newlib/libc/include/time.h).

However, as both you and Angelo get a zero return value, I must look at 
the wrong file.

Tobias

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list