]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
dmesg: use symbolic defines for second conversions
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 10 Dec 2023 08:58:27 +0000 (09:58 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Mon, 11 Dec 2023 11:03:44 +0000 (12:03 +0100)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
sys-utils/dmesg.c

index 69bdad71a682083db3bc9a24b0d69c8e325548a9..d3e36e05728850673519fa5e27aae53eb0f79cd6 100644 (file)
@@ -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)