events: now support timedelta instead of int/float
This commit is contained in:
parent
f520c67c89
commit
4275009dea
1 changed files with 8 additions and 2 deletions
|
@ -63,8 +63,14 @@ class ModuleEvent:
|
||||||
self.call_data = func_data
|
self.call_data = func_data
|
||||||
|
|
||||||
# Store times
|
# Store times
|
||||||
self.offset = timedelta(seconds=offset) # Time to wait before the first check
|
if isinstance(offset, timedelta):
|
||||||
self.interval = timedelta(seconds=interval)
|
self.offset = offset # Time to wait before the first check
|
||||||
|
else:
|
||||||
|
self.offset = timedelta(seconds=offset) # Time to wait before the first check
|
||||||
|
if isinstance(interval, timedelta):
|
||||||
|
self.interval = interval
|
||||||
|
else:
|
||||||
|
self.interval = timedelta(seconds=interval)
|
||||||
self._end = None # Cache
|
self._end = None # Cache
|
||||||
|
|
||||||
# How many times do this event?
|
# How many times do this event?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue