events: now support timedelta instead of int/float

This commit is contained in:
nemunaire 2018-01-04 18:16:47 +01:00
parent f520c67c89
commit 4275009dea

View file

@ -63,7 +63,13 @@ class ModuleEvent:
self.call_data = func_data
# Store times
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