mirror of
https://github.com/python/cpython.git
synced 2025-10-03 21:55:41 +00:00
[3.6] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2497)
* bpo-30807: signal.setitimer() may disable the timer by mistake
* Add NEWS blurb
(cherry picked from commit 729780a810
)
This commit is contained in:
parent
6f31717c47
commit
6f3cb059fd
3 changed files with 19 additions and 0 deletions
|
@ -139,6 +139,10 @@ timeval_from_double(double d, struct timeval *tv)
|
|||
{
|
||||
tv->tv_sec = floor(d);
|
||||
tv->tv_usec = fmod(d, 1.0) * 1000000.0;
|
||||
/* Don't disable the timer if the computation above rounds down to zero. */
|
||||
if (d > 0.0 && tv->tv_sec == 0 && tv->tv_usec == 0) {
|
||||
tv->tv_usec = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Py_LOCAL_INLINE(double)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue