diff options
| author | Huoyanlifusu <[email protected]> | 2026-10-19 09:23:36 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-10-29 09:33:44 +0800 |
| commit | 6040d6cf2cd96dbea5f57cf5537738a96f114ef0 (patch) | |
| tree | 531d1bac1327bed5f52341110850a6a5cbe20fbd /components | |
| parent | b88861d285d6fdc323360b8ca69629f82ae6f6d8 (diff) | |
[components][netdev] Fix ping maximum & minimum latency counting
Diffstat (limited to 'components')
| -rw-r--r-- | components/net/netdev/src/netdev.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c index 6b6429ed4b..93b6baf0e5 100644 --- a/components/net/netdev/src/netdev.c +++ b/components/net/netdev/src/netdev.c @@ -1400,7 +1400,11 @@ int netdev_cmd_ping(char* target_name, char *netdev_name, rt_uint32_t times, rt_ ping_resp.data_len, inet_ntoa(ping_resp.ip_addr), index + 1, ping_resp.ttl, ping_resp.ticks); } received += 1; - if (ping_resp.ticks > max_time) + if (received == 1) + { + max_time = min_time = ping_resp.ticks; + } + else if (ping_resp.ticks > max_time) { max_time = ping_resp.ticks; } |
