It's late and I haven't had time to test this, but I thought it deserved a
look. There appears to be some confusion (at least in my head) about the
units of gtod.resolution() and minperiod.
2006-02-10 Brian Ford <[EMAIL PROTECTED]>
* times.cc (clock_gettime): Properly convert ms period to struct
timespec.
(clock_settime): Likewise reverse convert.
Let me know if I'm just crazy ;-). Thanks.
--
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...Index: times.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/times.cc,v
retrieving revision 1.87
diff -u -p -r1.87 times.cc
--- times.cc 13 Dec 2005 02:55:11 -0000 1.87
+++ times.cc 10 Feb 2006 23:42:19 -0000
@@ -711,8 +711,8 @@ clock_getres (clockid_t clk_id, struct t
DWORD period = gtod.resolution ();
- tp->tv_sec = period / 1000000;
- tp->tv_nsec = (period % 1000000) * 1000;
+ tp->tv_sec = period / 1000;
+ tp->tv_nsec = (period % 1000) * 1000000;
return 0;
}
@@ -730,7 +730,7 @@ clock_setres (clockid_t clk_id, struct t
if (period_set)
timeEndPeriod (minperiod);
- DWORD period = (tp->tv_sec * 1000) + ((tp->tv_nsec) / 1000);
+ DWORD period = (tp->tv_sec * 1000) + ((tp->tv_nsec) / 1000000);
if (timeBeginPeriod (period))
{