]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
dmesg: don't affect delta by --since
authorKarel Zak <kzak@redhat.com>
Tue, 13 Feb 2024 09:53:41 +0000 (10:53 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 13 Feb 2024 09:53:41 +0000 (10:53 +0100)
Fixes: https://github.com/util-linux/util-linux/issues/2770
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/dmesg.c

index cc24334dec255041da6dd26fd8387626f994f1ba..3dde45d54b831a8f226fd99ac975834cb7163a16 100644 (file)
@@ -1122,8 +1122,12 @@ static void print_record(struct dmesg_control *ctl,
        double delta = 0;
        size_t format_iter = 0;
 
-       if (!accept_record(ctl, rec))
+       if (!accept_record(ctl, rec)) {
+               /* remember time of the rejected record to not affect delta for
+                * the following records */
+               ctl->lasttime = rec->tv;
                return;
+       }
 
        if (!rec->mesg_size) {
                if (!ctl->json)