Fixing division by 0 exception
This commit is contained in:
parent
4e13d97c0a
commit
462fbac614
@ -333,7 +333,7 @@ class SyncFactory(Factory):
|
|||||||
pmax = max(p for p,_ in watcher.time_offset_data) - pmin
|
pmax = max(p for p,_ in watcher.time_offset_data) - pmin
|
||||||
psum, pweights = 0, 0
|
psum, pweights = 0, 0
|
||||||
for ping, offset in watcher.time_offset_data:
|
for ping, offset in watcher.time_offset_data:
|
||||||
ping = 1-((ping-pmin)/pmax)
|
ping = 1-((ping-pmin)/pmax) if(pmax <> 0) else 0
|
||||||
pweights += ping
|
pweights += ping
|
||||||
psum += ping*offset
|
psum += ping*offset
|
||||||
watcher.time_offset = psum/pweights
|
watcher.time_offset = psum/pweights
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user