Skip to content
Snippets Groups Projects
Unverified Commit b4b088be authored by Marian Buschsieweke's avatar Marian Buschsieweke
Browse files

shell_commands/ping6: Fixed bug in calculation of average round trip time

The average rout trip time has been to low in case packets were lost, as lost
packets were treated as if that had an RTT of 0.
parent d3a86f7d
No related branches found
No related tags found
No related merge requests found
...@@ -129,7 +129,7 @@ static void _print_stats(char *addr_str, int success, int count, uint64_t total_ ...@@ -129,7 +129,7 @@ static void _print_stats(char *addr_str, int success, int count, uint64_t total_
printf("--- %s ping statistics ---\n", addr_str); printf("--- %s ping statistics ---\n", addr_str);
if (success > 0) { if (success > 0) {
uint32_t avg_rtt = (uint32_t)(sum_rtt / count); /* get average */ uint32_t avg_rtt = (uint32_t)(sum_rtt / success); /* get average */
printf("%d packets transmitted, %d received, %d%% packet loss, time %" printf("%d packets transmitted, %d received, %d%% packet loss, time %"
PRIu32 ".06%" PRIu32 " s\n", count, success, PRIu32 ".06%" PRIu32 " s\n", count, success,
(100 - ((success * 100) / count)), (100 - ((success * 100) / count)),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment