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
|
||||
|
||||
# Store times
|
||||
self.offset = timedelta(seconds=offset) # Time to wait before the first check
|
||||
self.interval = timedelta(seconds=interval)
|
||||
if isinstance(offset, timedelta):
|
||||
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
|
||||
|
||||
# How many times do this event?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue