Révision 3e015885
Plugin timesync_status: Handle value 0 correctly
| plugins/systemd/timesync_status | ||
|---|---|---|
| 57 | 57 |
if ' ' in value: |
| 58 | 58 |
return sum(parse_time(x) for x in value.split(' '))
|
| 59 | 59 |
|
| 60 |
# If time is exactly zero (for example Jitter), there is no unit (suffix) |
|
| 61 |
if value == "0" or value == "-0": |
|
| 62 |
return 0 |
|
| 63 |
|
|
| 60 | 64 |
match = re.match(r'^([+-]?[0-9.]+)([a-z]+)$', value) |
| 61 | 65 |
if not match: |
| 62 | 66 |
raise ValueError('Invalid time ' + value)
|
Formats disponibles : Unified diff