Lines Matching defs:time
8 supposed to return the current time, one that is supposed to
9 implement a delay. You can implement real-time scheduling by
10 substituting time and sleep from built-in module time, or you can
11 implement simulated time by writing your own functions. This can
16 Events are specified by tuples (time, priority, action, argument, kwargs).
26 import time
31 from time import monotonic as _time
35 Event = namedtuple('Event', 'time, priority, sequence, action, argument, kwargs')
36 Event.time.__doc__ = ('''Numeric type compatible with the return value of the
38 Event.priority.__doc__ = ('''Events scheduled for the same time will be executed
41 separates events if time and priority are equal.''')
53 def __init__(self, timefunc=_time, delayfunc=time.sleep):
54 """Initialize a new instance, passing the time and delay
62 def enterabs(self, time, priority, action, argument=(), kwargs=_sentinel):
63 """Enter a new event in the queue at an absolute time.
73 event = Event(time, priority, next(self._sequence_generator),
79 """A variant that specifies the time as a relative time.
84 time = self.timefunc() + delay
85 return self.enterabs(time, priority, action, argument, kwargs)
138 (time, priority, sequence, action,
141 if time > now:
148 return time - now
149 delayfunc(time - now)
159 time, priority, action, arguments, kwargs
163 # With heapq, two events scheduled at the same time will show in