mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
Issue #23646: Enhance precision of time.sleep() and socket timeout when
interrupted by a signal Add a new _PyTime_AddDouble() function and remove _PyTime_ADD_SECONDS() macro. The _PyTime_ADD_SECONDS only supported an integer number of seconds, the _PyTime_AddDouble() has subsecond resolution.
This commit is contained in:
parent
4fa99cdb4c
commit
9a8089b32a
5 changed files with 27 additions and 15 deletions
|
@ -687,7 +687,7 @@ internal_select(PySocketSockObject *s, int writing)
|
|||
if (has_timeout) { \
|
||||
_PyTime_monotonic(&now); \
|
||||
deadline = now; \
|
||||
_PyTime_ADD_SECONDS(deadline, s->sock_timeout); \
|
||||
_PyTime_AddDouble(&deadline, s->sock_timeout, _PyTime_ROUND_UP); \
|
||||
} \
|
||||
while (1) { \
|
||||
errno = 0; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue