This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use monotonic time for sched, trace and subprocess modules
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, giampaolo.rodola, neologix, python-dev, rhettinger, vstinner
Priority: normal Keywords: patch

Created on 2012-04-29 01:18 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
use_monotonic.patch vstinner, 2012-04-29 01:18 review
Messages (3)
msg159559 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-04-29 01:18
The PEP 418 added a new time.monotonic() function. The sched, trace and subprocess modules should use it, if available, to avoid issues when the system time is changed.

Attached patch uses the time.monotonic() function when available.

See also the issue #14222 (same issue for queue and threading) and the PEP 418.

--

socket and ssl modules should also use a monotonic clock if available, but these modules are implemented in C. The C implementation of time.monotonic() requires the librt library and is written in the timemodule.c. It requires more work to reuse it in the socket and ssl modules.
msg159592 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2012-04-29 09:12
LGTM.
Juste one nitpick: why do you sometimes import the clock source as get_time() and others _time()? _time() looks fine to me.
msg161945 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-30 11:31
New changeset 1345cf58738d by Victor Stinner in branch 'default':
Close #14690: Use monotonic clock instead of system clock in the sched,
http://hg.python.org/cpython/rev/1345cf58738d
History
Date User Action Args
2022-04-11 14:57:29adminsetgithub: 58895
2012-05-30 11:31:52python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg161945

resolution: fixed
stage: resolved
2012-04-29 09:12:01neologixsetmessages: + msg159592
2012-04-29 01:27:20vstinnersetnosy: + belopolsky
2012-04-29 01:22:46pitrousetnosy: + giampaolo.rodola
2012-04-29 01:18:53vstinnercreate