[Patch]: hires_ms::usecs

Pierre A. Humblet pierre@phumblet.no-ip.org
Sun Mar 27 20:23:00 GMT 2005


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 ();



More information about the Cygwin-patches mailing list