* times.cc (hires_ms::usecs): Reinit timer when system time overflows.

This commit is contained in:
Corinna Vinschen 2004-06-30 15:50:08 +00:00
parent 81223d017f
commit fbd5a0b8da
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2004-06-30 Corinna Vinschen <corinna@vinschen.de>
* times.cc (hires_ms::usecs): Reinit timer when system time overflows.
2004-06-27 Christopher Faylor <me@cgf.cx>
* thread.cc (__cygwin_lock_lock): Don't bother locking when there is

View File

@ -658,6 +658,12 @@ hires_ms::usecs (bool justdelta)
if (!minperiod) /* NO_COPY variable */
prime ();
DWORD now = timeGetTime ();
if (now <= initime_ms)
{
inited = 0;
prime ();
now = timeGetTime ();
}
// FIXME: Not sure how this will handle the 49.71 day wrap around
LONGLONG res = initime_us.QuadPart + ((LONGLONG) (now - initime_ms) * 1000);
return res;