commit:     7698b3a4e1bdd309a77f075e430e9ef2b00d2daa
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 13 12:58:27 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Nov 13 12:58:27 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7698b3a4

qlop: avoid reporting bogus dates in fmt_elapsedtime

when the calculated seconds are negative, we probably had a corrupt log,
so just garbage in/garbage out without trying to interpret it or
something

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qlop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qlop.c b/qlop.c
index 95cd64b..dcf1d47 100644
--- a/qlop.c
+++ b/qlop.c
@@ -225,7 +225,7 @@ static char *fmt_elapsedtime(struct qlop_mode *flags, 
time_t e)
        time_t ss;
        size_t bufpos = 0;
 
-       if (flags->do_machine) {
+       if (flags->do_machine || e < 0) {
                snprintf(_elapsed_buf, sizeof(_elapsed_buf),
                                "%s%zd%s",
                                GREEN, (size_t)e, NORM);

Reply via email to