From: Thomas Weißschuh Date: Sat, 21 Jan 2023 00:44:14 +0000 (+0000) Subject: dmesg: use subsecond granularity in iso format X-Git-Tag: v2.39-rc1~114^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8949ec930a78abcd71a2c3433c7253fc9633853d;p=thirdparty%2Futil-linux.git dmesg: use subsecond granularity in iso format Signed-off-by: Thomas Weißschuh --- diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index fdf0f46314..45075e50bd 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -878,10 +878,10 @@ static char *short_ctime(struct tm *tm, char *buf, size_t bufsiz) static char *iso_8601_time(struct dmesg_control *ctl, struct dmesg_record *rec, char *buf, size_t bufsz) { - struct timeval tv = { - .tv_sec = ctl->boot_time.tv_sec + ctl->suspended_time / USEC_PER_SEC + rec->tv.tv_sec, - .tv_usec = rec->tv.tv_usec - }; + struct timeval tv = usec_to_timeval( + timeval_to_usec(&ctl->boot_time) + ctl->suspended_time + + timeval_to_usec(&rec->tv) + ); if (strtimeval_iso(&tv, ISO_TIMESTAMP_COMMA_T, buf, bufsz) != 0) return NULL; diff --git a/tests/expected/dmesg/indentation b/tests/expected/dmesg/indentation index e1b2770d1c..dc08810c0a 100644 --- a/tests/expected/dmesg/indentation +++ b/tests/expected/dmesg/indentation @@ -28,8 +28,8 @@ lines [Fri Feb 13 23:31:32 2009] two new lines -2009-02-13T23:31:31,000000+00:00 new +2009-02-13T23:31:31,123456+00:00 new line -2009-02-13T23:31:32,000000+00:00 two +2009-02-13T23:31:32,123456+00:00 two new lines