diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-20 00:42:20 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-20 00:42:20 (GMT) |
commit | 9a8089b32adee874caefbe2a96096998625c5a78 (patch) | |
tree | bf91050cbe41ad7811a975acc3bab8ed4ee97c02 /Lib/test/eintrdata | |
parent | 4fa99cdb4c5f53d6fa86ef223ae613cb1a8783f8 (diff) | |
download | cpython-9a8089b32adee874caefbe2a96096998625c5a78.zip cpython-9a8089b32adee874caefbe2a96096998625c5a78.tar.gz cpython-9a8089b32adee874caefbe2a96096998625c5a78.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/eintrdata')
-rw-r--r-- | Lib/test/eintrdata/eintr_tester.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py index 400dd21..64db2e5 100644 --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -258,13 +258,10 @@ class TimeEINTRTest(EINTRBaseTest): def test_sleep(self): t0 = time.monotonic() - # time.sleep() may retry when interrupted by a signal - time.sleep(2) + time.sleep(self.sleep_time) signal.alarm(0) dt = time.monotonic() - t0 - # Tolerate a difference 100 ms: on Windows, time.monotonic() has - # a resolution of 15.6 ms or greater - self.assertGreaterEqual(dt, 1.9) + self.assertGreaterEqual(dt, self.sleep_time) def test_main(): |