use +=timedelta(minutes=1) when calculating next minute

closes #223
This commit is contained in:
jesopo 2019-12-19 14:02:55 +00:00
parent e458127fb5
commit a2ac26c072

View file

@ -4,7 +4,8 @@ from src import ModuleManager, utils
class Module(ModuleManager.BaseModule):
def on_load(self):
now = datetime.datetime.utcnow()
next_minute = now.replace(minute=now.minute+1, second=0, microsecond=0)
next_minute = now.replace(second=0, microsecond=0)
next_minute += datetime.timedelta(minutes=1)
until = time.time()+((next_minute-now).total_seconds())
self.timers.add("cron", self._minute, 60, until)