mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Plugin timesync_status: Handle value 0 correctly
This commit is contained in:
parent
9c995590b2
commit
3e01588570
1 changed files with 4 additions and 0 deletions
|
@ -57,6 +57,10 @@ def parse_time(value):
|
||||||
if ' ' in value:
|
if ' ' in value:
|
||||||
return sum(parse_time(x) for x in value.split(' '))
|
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)
|
match = re.match(r'^([+-]?[0-9.]+)([a-z]+)$', value)
|
||||||
if not match:
|
if not match:
|
||||||
raise ValueError('Invalid time ' + value)
|
raise ValueError('Invalid time ' + value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue