* times.cc (hires_ms::resolution): Make sure resolution is never 0.

(clock_setres): Ditto.
This commit is contained in:
Corinna Vinschen 2011-03-30 11:30:34 +00:00
parent 51564c783f
commit af23d12d33
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2011-03-30 Corinna Vinschen <corinna@vinschen.de>
* times.cc (hires_ms::resolution): Make sure resolution is never 0.
(clock_setres): Ditto.
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
* cygtls.h (struct _local_storage): Redefine process_ident as wchar_t

View File

@ -827,6 +827,10 @@ hires_ms::resolution ()
period /= 40000L;
minperiod = (DWORD) period;
}
/* The resolution can be as low as 5000 100ns intervals on recent OSes.
We have to make sure that the resolution in ms is never 0. */
if (!minperiod)
minperiod = 1L;
}
return minperiod;
}
@ -901,6 +905,10 @@ clock_setres (clockid_t clk_id, struct timespec *tp)
return -1;
}
minperiod = actual / 10000L;
/* The resolution can be as low as 5000 100ns intervals on recent OSes.
We have to make sure that the resolution in ms is never 0. */
if (!minperiod)
minperiod = 1L;
period_set = true;
return 0;
}