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.
This commit is contained in:
Marian Buschsieweke 2018-05-29 12:36:05 +02:00
parent d3a86f7df2
commit b4b088be9e
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F

View File

@ -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);
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 %"
PRIu32 ".06%" PRIu32 " s\n", count, success,
(100 - ((success * 100) / count)),