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, haypo, neologix, python-dev, rhettinger
Priority: normal Keywords: patch

Created on 2012-04-29 01:18 by haypo, last changed 2012-05-30 11:31 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
use_monotonic.patch haypo, 2012-04-29 01:18 review
Messages (3)
msg159559 - (view) Author: STINNER Victor (haypo) * (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) 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
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:20hayposetnosy: + belopolsky
2012-04-29 01:22:46pitrousetnosy: + giampaolo.rodola
2012-04-29 01:18:53haypocreate