1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Plugin timesync_status: Handle value 0 correctly

This commit is contained in:
Ondřej Nový 2020-05-26 16:57:16 +02:00 committed by Lars Kruse
parent 9c995590b2
commit 3e01588570

View file

@ -57,6 +57,10 @@ def parse_time(value):
if ' ' in value:
return sum(parse_time(x) for x in value.split(' '))
# If time is exactly zero (for example Jitter), there is no unit (suffix)
if value == "0" or value == "-0":
return 0
match = re.match(r'^([+-]?[0-9.]+)([a-z]+)$', value)
if not match:
raise ValueError('Invalid time ' + value)