mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #3081 from OlegHahm/ping6_output_fix
ping6: fix output for nanospecs
This commit is contained in:
commit
fe462fe9f1
@ -79,11 +79,12 @@ int _handle_reply(ng_pktsnip_t *pkt, uint64_t time)
|
|||||||
|
|
||||||
if ((byteorder_ntohs(icmpv6_hdr->id) == id) &&
|
if ((byteorder_ntohs(icmpv6_hdr->id) == id) &&
|
||||||
(byteorder_ntohs(icmpv6_hdr->seq) == seq)) {
|
(byteorder_ntohs(icmpv6_hdr->seq) == seq)) {
|
||||||
printf("%zu bytes from %s: id=%" PRIu16 " seq=%" PRIu16 " hop limit=%" PRIu8
|
timex_t rt = timex_from_uint64(time);
|
||||||
"time = %" PRIu64 ".%03" PRIu64 " ms\n", icmpv6->size,
|
printf("%u bytes from %s: id=%" PRIu16 " seq=%" PRIu16 " hop limit=%" PRIu8
|
||||||
|
" time = %" PRIu32 ".%03" PRIu32 " ms\n", (unsigned) icmpv6->size,
|
||||||
ng_ipv6_addr_to_str(ipv6_str, &(ipv6_hdr->src), sizeof(ipv6_str)),
|
ng_ipv6_addr_to_str(ipv6_str, &(ipv6_hdr->src), sizeof(ipv6_str)),
|
||||||
byteorder_ntohs(icmpv6_hdr->id), byteorder_ntohs(icmpv6_hdr->seq),
|
byteorder_ntohs(icmpv6_hdr->id), byteorder_ntohs(icmpv6_hdr->seq),
|
||||||
ipv6_hdr->hl, time / MS_IN_USEC, time % MS_IN_USEC);
|
ipv6_hdr->hl, rt.seconds, rt.microseconds);
|
||||||
ng_ipv6_nc_still_reachable(&ipv6_hdr->src);
|
ng_ipv6_nc_still_reachable(&ipv6_hdr->src);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -214,18 +215,16 @@ int _icmpv6_ping(int argc, char **argv)
|
|||||||
|
|
||||||
if (success > 0) {
|
if (success > 0) {
|
||||||
printf("%d packets transmitted, %d received, %d%% packet loss, time %"
|
printf("%d packets transmitted, %d received, %d%% packet loss, time %"
|
||||||
PRIu64 " ms\n", n, success, (success - n) / n,
|
PRIu32 ".03%" PRIu32 " s\n", n, success, (success - n) / n,
|
||||||
timex_uint64(sum_rtt) / MS_IN_USEC);
|
sum_rtt.seconds, sum_rtt.microseconds);
|
||||||
uint64_t avg_rtt = timex_uint64(sum_rtt) / n; /* get average */
|
timex_t avg_rtt = timex_from_uint64(timex_uint64(sum_rtt) / n); /* get average */
|
||||||
printf("rtt min/avg/max = "
|
printf("rtt min/avg/max = "
|
||||||
"%" PRIu64 ".%03" PRIu64 "/"
|
"%" PRIu32 ".%03" PRIu32 "/"
|
||||||
"%" PRIu64 ".%03" PRIu64 "/"
|
"%" PRIu32 ".%03" PRIu32 "/"
|
||||||
"%" PRIu64 ".%03" PRIu64 " ms\n",
|
"%" PRIu32 ".%03" PRIu32 " ms\n",
|
||||||
timex_uint64(min_rtt) / MS_IN_USEC,
|
min_rtt.seconds, min_rtt.microseconds,
|
||||||
timex_uint64(min_rtt) % MS_IN_USEC,
|
avg_rtt.seconds, avg_rtt.microseconds,
|
||||||
avg_rtt / MS_IN_USEC, avg_rtt % MS_IN_USEC, /* sum is now avg, see above */
|
max_rtt.seconds, max_rtt.microseconds);
|
||||||
timex_uint64(max_rtt) / MS_IN_USEC,
|
|
||||||
timex_uint64(max_rtt) % MS_IN_USEC);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%d packets transmitted, 0 received, 100%% packet loss\n", n);
|
printf("%d packets transmitted, 0 received, 100%% packet loss\n", n);
|
||||||
|
Loading…
Reference in New Issue
Block a user