From: Thomas Weißschuh Date: Sun, 10 Dec 2023 08:58:27 +0000 (+0100) Subject: dmesg: use symbolic defines for second conversions X-Git-Tag: v2.40-rc1~111^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=899f554f19beded78fce1bbe1ee0c0b9355db27d;p=thirdparty%2Futil-linux.git dmesg: use symbolic defines for second conversions Signed-off-by: Thomas Weißschuh --- diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index 69bdad71a6..d3e36e0572 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -523,8 +523,8 @@ static const char *parse_kmsg_timestamp(const char *str0, struct timeval *tv) usec = strtoumax(str, &end, 10); if (!errno && end && (*end == ';' || *end == ',')) { - tv->tv_usec = usec % 1000000; - tv->tv_sec = usec / 1000000; + tv->tv_usec = usec % USEC_PER_SEC; + tv->tv_sec = usec / USEC_PER_SEC; } else return str0; @@ -534,7 +534,7 @@ static const char *parse_kmsg_timestamp(const char *str0, struct timeval *tv) static double time_diff(struct timeval *a, struct timeval *b) { - return (a->tv_sec - b->tv_sec) + (a->tv_usec - b->tv_usec) / 1E6; + return (a->tv_sec - b->tv_sec) + (a->tv_usec - b->tv_usec) / USEC_PER_SEC; } static int get_syslog_buffer_size(void)