From a2ac26c07209c2f038c9ac9632924dbe2c68ac95 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 19 Dec 2019 14:02:55 +0000 Subject: [PATCH] use +=timedelta(minutes=1) when calculating next minute closes #223 --- src/core_modules/cron.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core_modules/cron.py b/src/core_modules/cron.py index fa6b15a3..69e0105b 100644 --- a/src/core_modules/cron.py +++ b/src/core_modules/cron.py @@ -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)