Issue 14690: Use monotonic time for sched, trace and subprocess modules (original) (raw)

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.