Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-03-30 15:30:34 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-03-30 15:30:34 +0400
commitaf23d12d330275930b424341ffd0da9cf686f0f5 (patch)
tree2d187ea6994609d67f3cad3a6ad0e7cf794bd28a /winsup/cygwin/times.cc
parent51564c783f61f2c218badac70366381b8abb4c4f (diff)
* times.cc (hires_ms::resolution): Make sure resolution is never 0.
(clock_setres): Ditto.
Diffstat (limited to 'winsup/cygwin/times.cc')
-rw-r--r--winsup/cygwin/times.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index 19c03fdf8..e9f2b8e46 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -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;
}