diff mbox series

[iproute] ss: fix expired time format of timer

Message ID tencent_EFD6593E69AD867624E4518D515816F58505@qq.com (mailing list archive)
State Accepted
Commit 3e807112fdf3d7b89a8295379dd8474f08a38b4b
Delegated to: Stephen Hemminger
Headers show
Series [iproute] ss: fix expired time format of timer | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

xixiliguo July 20, 2024, 3:23 p.m. UTC
When expired time of time-wait timer is less than or equal to 9 seconds,
as shown below, result that below 1 sec is incorrect.
Expect output should be show 9 seconds and 373 millisecond, but 9.373ms
mean only 9 millisecond and 373 microseconds

Before:
TIME-WAIT 0      0     ...    timer:(timewait,12sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,11sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,10sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,9.373ms,0)
TIME-WAIT 0      0     ...    timer:(timewait,8.679ms,0)
TIME-WAIT 0      0     ...    timer:(timewait,1.574ms,0)
TIME-WAIT 0      0     ...    timer:(timewait,954ms,0)
TIME-WAIT 0      0     ...    timer:(timewait,303ms,0)

After:
TIME-WAIT 0      0     ...    timer:(timewait,13sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,12sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,10sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,9.501sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,8.990sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,7.865sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,1.098sec,0)
TIME-WAIT 0      0     ...    timer:(timewait,476ms,0)

Signed-off-by: xixiliguo <xixiliguo@foxmail.com>
---
 misc/ss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 25, 2024, 5:40 p.m. UTC | #1
Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Sat, 20 Jul 2024 23:23:27 +0800 you wrote:
> When expired time of time-wait timer is less than or equal to 9 seconds,
> as shown below, result that below 1 sec is incorrect.
> Expect output should be show 9 seconds and 373 millisecond, but 9.373ms
> mean only 9 millisecond and 373 microseconds
> 
> Before:
> TIME-WAIT 0      0     ...    timer:(timewait,12sec,0)
> TIME-WAIT 0      0     ...    timer:(timewait,11sec,0)
> TIME-WAIT 0      0     ...    timer:(timewait,10sec,0)
> TIME-WAIT 0      0     ...    timer:(timewait,9.373ms,0)
> TIME-WAIT 0      0     ...    timer:(timewait,8.679ms,0)
> TIME-WAIT 0      0     ...    timer:(timewait,1.574ms,0)
> TIME-WAIT 0      0     ...    timer:(timewait,954ms,0)
> TIME-WAIT 0      0     ...    timer:(timewait,303ms,0)
> 
> [...]

Here is the summary with links:
  - [iproute] ss: fix expired time format of timer
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=3e807112fdf3

You are awesome, thank you!
diff mbox series

Patch

diff --git a/misc/ss.c b/misc/ss.c
index 27f0f20d..620f4c8f 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1516,7 +1516,7 @@  static const char *print_ms_timer(unsigned int timeout)
 		sprintf(buf+strlen(buf), "%d%s", secs, msecs ? "." : "sec");
 	}
 	if (msecs)
-		sprintf(buf+strlen(buf), "%03dms", msecs);
+		sprintf(buf+strlen(buf), "%03d%s", msecs, secs ? "sec" : "ms");
 	return buf;
 }