mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Change stats collation for LTS to the median, thereby avoiding summing overflows.
This commit is contained in:
@@ -40,9 +40,11 @@ impl<
|
||||
min = T::min(min, *n);
|
||||
max = T::max(max, *n);
|
||||
});
|
||||
let length = stats.len();
|
||||
let mut values = stats.to_vec();
|
||||
values.sort();
|
||||
let length = values.len();
|
||||
let median = if length == 0 { T::zero() } else {
|
||||
stats[length/2]
|
||||
values[length/2]
|
||||
};
|
||||
|
||||
Self { max, min, avg: median(stats): median }
|
||||
|
||||
Reference in New Issue
Block a user