[PATCH] POSIX monotonic clock

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Tue Aug 3 00:37:00 GMT 2010


On Mon, Aug 02, 2010 at 03:49:08PM -0500, Yaakov (Cygwin/X) wrote:
>Here is an attempt to implement POSIX.1-2004+ Monotonic Clock:
>
>http://www.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
>
>In summary, I took hires_us and changed the resolution to nanoseconds. I
>dropped systime() because the only place hires_us was being used is in
>strace.cc which ignored it, and WRT POSIX monotonic clocks the absolute
>value of the clock is meaningless.  Since systime() has only 100ns
>precision, using it would either force a loss in resolution or (if
>multiplied by 100 to get ns) an early overflow.  I also switched from
>ENOSYS to EINVAL, as POSIX.1-2004 and 2008 dropped references to the
>former (as noted in Change History).

But that changes the sense of the errno.  EINVAL would indicate an unsupported
argument.  At least some of the cases fail because of an unimplemented NT
function call, e.g., ENOSYS.  Regardless of what POSIX says, I think that ENOSYS
is ok, in at least some cases, for Cygwin since I believe QueryPerformanceCounter
doesn't work on NT3.5 and NT4.

Other than that this looks ok.

cgf



More information about the Cygwin-patches mailing list