summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorDmitriyEshenko <dmitriy.eshenko@vyos.io>2020-11-13 09:46:52 +0000
committerDmitriyEshenko <dmitriy.eshenko@vyos.io>2020-11-13 09:46:52 +0000
commitcdb55057dae966c108cfdffc3a0673cfc3862180 (patch)
tree63bc135c8d68cecb69b4a88ab803275aef90e2b5 /src/op_mode
parent62320efc3866fa582852258846c15bfa09a92720 (diff)
downloadvyos-1x-cdb55057dae966c108cfdffc3a0673cfc3862180.tar.gz
vyos-1x-cdb55057dae966c108cfdffc3a0673cfc3862180.zip
powerctl: T3066: Calculate minutes over 60
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/powerctrl.py6
1 files changed, 5 insertions, 1 deletions
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: