This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Ciao Angelo, Angelo Graziosi wrote:
$ ./a.exe gettimeofday: err=0, secs=1365678623, usecs=437500 clock_gettime: err=0, secs=1365678623, usecs=437500 time: err=0, secs=1365678623, usecs=0 clock_gettime: err=0, secs=0, nsecs=0, tck=1000000000 $ ./a.exe gettimeofday: err=0, secs=1365678667, usecs=484375 clock_gettime: err=0, secs=1365678667, usecs=484375 time: err=0, secs=1365678667, usecs=0 clock_gettime: err=0, secs=0, nsecs=0, tck=1000000000
It seems as if Cygwin's clock_gettime correctly works for CLOCK_REALTIME but not for CLOCK_MONOTONIC.
In libgfortran: /* POSIX states that CLOCK_REALTIME must be present if clock_gettime is available, others are optional. */ #ifdef CLOCK_MONOTONIC #define GF_CLOCK_MONOTONIC CLOCK_MONOTONIC #else #define GF_CLOCK_MONOTONIC CLOCK_REALTIME #endifBut that doesn't help if CLOCK_MONOTONIC is defined but doesn't work. The question is whether checking additionally for _POSIX_MONOTONIC_CLOCK [1] will correctly detect this.
However, it seems as if Cygwin sets it - possibly without even supporting CLOCK_MONOTONIC, http://sourceware.org/ml/newlib/2010/msg00454.html - In any case, the patch was approved before MONOTONIC_CLOCK was submitted. I couldn't find the actual patch, but I might have missed it.
And if I do a grep on my Linux system, I only find in /usr/include/bits/posix_opt.h:
/* The monotonic clock might be available. */ #define _POSIX_MONOTONIC_CLOCK 0That's better than the "-1" for not available but is not the, e.g., 200809L which states that the support is indeed available.
Does anyone have a good suggestion how to detect the availability? Tobias [1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap02.html
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |