From b150f5236b5dd8318bb9fef8188517894e3f186c Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 9 Aug 2010 16:47:48 +0000 Subject: Implement POSIX.1-2004 Monotonic Clock. * hires.h: Change hires_us to hires_ns, with nanosecond resolution. (hires_ns::primed_ft): Remove. (hires_ns::nsecs): New prototype. (hires_ns::usecs): Rewrite in terms of nsecs. (hires_ns::resolution): New prototype. * times.cc: Change hires_us to hires_ns. (ntod): Declare. (systime): Remove. (hires_ns::prime): Increase resolution to nanoseconds. (hires_ns::nsecs): Rename usecs to nsecs to reflect increased resolution. Remove justdelta argument. (hires_ns::resolution): New function. (clock_gettime): Accept CLOCK_MONOTONIC. Use EINVAL instead of ENOSYS per POSIX.1-2004. (clock_getres): Ditto. (clock_setres): Use EINVAL instead of ENOSYS to conform with other implementations. * strace.cc (strace::microseconds): Adjust for hires_ns. * sysconf.cc (sca): Set _SC_MONOTONIC_CLOCK to _POSIX_MONOTONIC_CLOCK. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. --- winsup/cygwin/hires.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/hires.h') diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h index 6a7fe8c72..5f87453d6 100644 --- a/winsup/cygwin/hires.h +++ b/winsup/cygwin/hires.h @@ -29,14 +29,15 @@ class hires_base void reset() {inited = false;} }; -class hires_us : public hires_base +class hires_ns : public hires_base { - LARGE_INTEGER primed_ft; LARGE_INTEGER primed_pc; double freq; void prime (); public: - LONGLONG usecs (bool justdelta); + LONGLONG nsecs (); + LONGLONG usecs () {return nsecs () / 1000LL;} + LONGLONG resolution(); }; class hires_ms : public hires_base -- cgit v1.2.3