Sitelet https://github.com/iputils/iputils/pull/621
Skip to content

ping: provide correct time in final statistics - #621

Open
dasha-uwu wants to merge 1 commit into
iputils:masterfrom
dasha-uwu:time-statistics
Open

dasha-uwu wants to merge 1 commit into
iputils:masterfrom
dasha-uwu:time-statistics

Conversation

@dasha-uwu

Copy link
Copy Markdown

Before:

$ ping -w 1 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.060 ms

--- 127.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.060/0.060/0.060/0.000 ms

After:

$ ping -w 1 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.022 ms

--- 127.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.022/0.022/0.022/0.000 ms

Signed-off-by: Daria Anisimova <dasha@linuxping.win>
@metan-ucw

Copy link
Copy Markdown
Contributor

A bit better description wouldn't harm, looks like the rts->cur_time is the last time we send a probe, so this all depends on how the overall time is defined. If it's defined as a period in which we were sending probes, the original code is correct. If the overall time is the time the ping program was running this change is correct. @pevik you decide.

@pevik
pevik requested review from a team, kerolasa, nmeyerhans and okias July 24, 2026 09:04
@pevik

pevik commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

A bit better description wouldn't harm,

+1. @dasha-uwu describing the goal or a motivation helps to understand your intention :).

looks like the rts->cur_time is the last time we send a probe, so this all depends on how the overall time is defined. If it's defined as a period in which we were sending probes, the original code is correct. If the overall time is the time the ping program was running this change is correct. @pevik you decide.

TL;DR I'm not sure myself. Due backwards compatibility I tend to keep the current state unless there is a good reason to change (more usable to change the behavior).

Unfortunately the man page does not describe it (we should document it). I suppose it was meant as it is now i.e. period in which we were sending probes (i.e. no bug), because it has been from the start 3337034 (in 2006). I searched the history. It was added in http://ftp.icm.edu.pl/packages/linux-iproute/ip-routing/iputils-ss010805.tar.gz, but RELNOTES file in the tarball does not mention this change. Also busybox ping uses this implementation. Inetutils ping does not print time at all.

I suppose the current functionality how long were sending probes useful for somebody. Although probably people expect ti might be how long the ping program was running one can get this value by using time shell buildin/tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants