apps/system/utils: Fix wrong calculation of packet loss
This patch fixes wrong calculation of packet loss percentage in ping utility.
when 'g_ping_recv_counter' becomes zero, 'packet loss' should be 100%.
But  with current calcualation it shows 'packet loss' as 'Infinity' as divisor 'g_ping_recv_counter' is zero.
@@ -323,9 +323,9 @@ int ping_process(int count, const char *taddr)
close(s);
printf("--- %s ping statistics ---\n", taddr);
- printf("%d packets transmitted, %d received, %f\%% packet loss,\n", ping_send_counter,
+ printf("%d packets transmitted, %d received, %f%% packet loss\n", ping_send_counter,
g_ping_recv_counter,
- (100.0f * (float)(g_ping_recv_counter - ping_send_counter))/(float)g_ping_recv_counter);
+ (100.0f * (float)(ping_send_counter - g_ping_recv_counter) / (float)ping_send_counter));
return OK;
}
