[PATCH] batctl: tcpdump: Fix printing of usecs
Sven Eckelmann <[email protected]>
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
musl on a 32 bit system still uses a 64-bit value (long long) for the storage of microseconds. But the printf was evaluating this argument always only as long. During the print of this usec value, range of 0-999_999 is only possible. 20 bit is therefore enough to store this range. For simplicity, just use an unsigned int. Signed-off-by: Sven Eckelmann <[email protected]> --- tcpdump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tcpdump.c b/tcpdump.c index 32f9a04..c89b5a7 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -102,7 +102,8 @@ static int print_time(void) tm = localtime(&tv.tv_sec); if (tm) - printf("%02d:%02d:%02d.%06ld ", tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec); + printf("%02d:%02d:%02d.%06u ", tm->tm_hour, tm->tm_min, tm->tm_sec, + (unsigned int)tv.tv_usec); else printf("00:00:00.000000 "); --- base-commit: 8d256ac07c7dada8607ae792dcd0524d91eef127 change-id: 20260308-t64-95a132121e4f Best regards, -- Sven Eckelmann <[email protected]>