summaryrefslogtreecommitdiffstats
path: root/Lib/sched.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-05-30 11:30:32 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-05-30 11:30:32 (GMT)
commit949d8c986ec8792fbe63d8bd2bb5332406c5af9a (patch)
tree192ad8ee5138f23b37b295272c245f568bf0d9b8 /Lib/sched.py
parent5e92a1ef5a906cd34f122cf0ee54e0303ae07a5f (diff)
downloadcpython-949d8c986ec8792fbe63d8bd2bb5332406c5af9a.zip
cpython-949d8c986ec8792fbe63d8bd2bb5332406c5af9a.tar.gz
cpython-949d8c986ec8792fbe63d8bd2bb5332406c5af9a.tar.bz2
Close #14690: Use monotonic clock instead of system clock in the sched,
subprocess and trace modules.
Diffstat (limited to 'Lib/sched.py')
-rw-r--r--Lib/sched.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/sched.py b/Lib/sched.py
index a89a118..5551f71 100644
--- a/Lib/sched.py
+++ b/Lib/sched.py
@@ -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 = []