Make the country RTTs actually add up

This commit is contained in:
Herbert Wolverson 2024-03-18 16:04:43 -05:00
parent bad4429729
commit 019d301913

View File

@ -82,18 +82,27 @@ impl TimeBuffer {
// Store the country
let rtt = [
if total_rtt[0] > 0.0 {
rtt_count[0] += 1;
(total_rtt[0] / rtt_count[0] as f64) as f32
} else {
0.0
},
if total_rtt[1] > 0.0 {
rtt_count[1] += 1;
(total_rtt[1] / rtt_count[1] as f64) as f32
} else {
0.0
},
];
country_summary.push((last_country, total_bytes, rtt));
if rtt_count[0] > 0 {
total_rtt[0] = (total_rtt[0] / rtt_count[0] as f64) as f64;
}
if rtt_count[1] > 0 {
total_rtt[1] = (total_rtt[1] / rtt_count[1] as f64) as f64;
}
country_summary.push((last_country, total_bytes, total_rtt));
}
last_country = country.to_string();