mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Close #14690: Use monotonic clock instead of system clock in the sched,
subprocess and trace modules.
This commit is contained in:
parent
5e92a1ef5a
commit
949d8c986e
4 changed files with 23 additions and 8 deletions
|
@ -35,6 +35,10 @@ try:
|
|||
import threading
|
||||
except ImportError:
|
||||
import dummy_threading as threading
|
||||
try:
|
||||
from time import monotonic as _time
|
||||
except ImportError:
|
||||
from time import time as _time
|
||||
|
||||
__all__ = ["scheduler"]
|
||||
|
||||
|
@ -48,7 +52,7 @@ class Event(namedtuple('Event', 'time, priority, action, argument, kwargs')):
|
|||
|
||||
class scheduler:
|
||||
|
||||
def __init__(self, timefunc=time.time, delayfunc=time.sleep):
|
||||
def __init__(self, timefunc=_time, delayfunc=time.sleep):
|
||||
"""Initialize a new instance, passing the time and delay
|
||||
functions"""
|
||||
self._queue = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue