This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
[Patch]: hires_ms::usecs
- From: "Pierre A. Humblet" <pierre at phumblet dot no-ip dot org>
- To: cygwin-patches at cygwin dot com
- Date: Sun, 27 Mar 2005 15:19:00 -0500
- Subject: [Patch]: hires_ms::usecs
The old test below will only detect the wraparound when "now" is
in the interval [0, inittime_ms), so it's likely to miss if
inittime_ms is very small (e.g. daemon starting at reboot).
With the new test, the wraparound will be detected if the function
is called at any time between the 25th and 49th day after startup.
Pierre
2005-03-27 Pierre Humblet <pierre.humblet@ieee.org>
*times.cc (hires_ms::usecs): Compare the difference.
Index: times.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/times.cc,v
retrieving revision 1.62
diff -u -p -r1.62 times.cc
--- times.cc 2 Mar 2005 08:28:54 -0000 1.62
+++ times.cc 27 Mar 2005 20:10:34 -0000
@@ -597,7 +597,7 @@ hires_ms::usecs (bool justdelta)
if (!minperiod) /* NO_COPY variable */
prime ();
DWORD now = timeGetTime ();
- if (now < initime_ms)
+ if (now - initime_ms < 0)
{
inited = 0;
prime ();