]>
jfr.im git - irc/rizon/acid.git/blob - pyva/src/main/python/task.py
6 def TimerCompare(t1
, t2
):
9 elif t1
.tick
> t2
.tick
:
15 _log
= logging
.getLogger(__name__
)
21 def start(self
, secs
, repeating
= True):
23 self
.tick
= int(time
.time()) + secs
24 self
.repeating
= repeating
26 if not timers
.count(self
):
28 timers
= sorted(timers
, cmp=TimerCompare
)
38 self
._log
.debug("Running timer " + str(self
.func
))
41 if not self
.repeating
:
45 self
.tick
= ts
+ self
.secs
46 timers
= sorted(timers
, cmp=TimerCompare
)
48 def LoopingCall(func
):
54 now
= int(time
.time())
57 while len(timers
) > 0 and timers
[0].tick
<= now
: