From cdb55057dae966c108cfdffc3a0673cfc3862180 Mon Sep 17 00:00:00 2001 From: DmitriyEshenko Date: Fri, 13 Nov 2020 09:46:52 +0000 Subject: powerctl: T3066: Calculate minutes over 60 --- src/op_mode/powerctrl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/op_mode') diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py index 69af427ec..c000d7d06 100755 --- a/src/op_mode/powerctrl.py +++ b/src/op_mode/powerctrl.py @@ -34,7 +34,11 @@ def utc2local(datetime): def parse_time(s): try: if re.match(r'^\d{1,2}$', s): - return datetime.strptime(s, "%M").time() + if (int(s) > 59): + s = str(int(s)//60) + ":" + str(int(s)%60) + return datetime.strptime(s, "%H:%M").time() + else: + return datetime.strptime(s, "%M").time() else: return datetime.strptime(s, "%H:%M").time() except ValueError: -- cgit v1.2.3