From b4b088be9eae59d2d7cfd05fce4627289eeeccba Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 29 May 2018 12:36:05 +0200 Subject: [PATCH] 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. --- sys/shell/commands/sc_icmpv6_echo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/shell/commands/sc_icmpv6_echo.c b/sys/shell/commands/sc_icmpv6_echo.c index f7b7a674c3..a473de6d32 100644 --- a/sys/shell/commands/sc_icmpv6_echo.c +++ b/sys/shell/commands/sc_icmpv6_echo.c @@ -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)),