summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2022-04-03 12:57:23 +0200
committerBenBE <BenBE@geshi.org>2022-04-21 08:56:56 +0200
commitb83ce85d89c6d368ffb8146043b878a441226ada (patch)
tree923031ec72ab0c41947c615440202290f8b4d4a8
parentee1bf2f9172ab11f867a87d7031408f9df1d8889 (diff)
Force elapsed time display to zero if process seems started in the future
-rw-r--r--Process.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Process.c b/Process.c
index 59006fa7..c8c2aa91 100644
--- a/Process.c
+++ b/Process.c
@@ -871,7 +871,15 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
Process_printLeftAlignedField(str, attr, cwd, 25);
return;
}
- case ELAPSED: Process_printTime(str, /* convert to hundreds of a second */ this->processList->realtimeMs / 10 - 100 * this->starttime_ctime, coloring); return;
+ case ELAPSED: {
+ const uint64_t rt = this->processList->realtimeMs;
+ const uint64_t st = this->starttime_ctime * 1000;
+ const uint64_t dt =
+ rt < st ? 0 :
+ rt - st;
+ Process_printTime(str, /* convert to hundreds of a second */ dt / 10, coloring);
+ return;
+ }
case MAJFLT: Process_printCount(str, this->majflt, coloring); return;
case MINFLT: Process_printCount(str, this->minflt, coloring); return;
case M_RESIDENT: Process_printKBytes(str, this->m_resident, coloring); return;

© 2014-2024 Faster IT GmbH | imprint | privacy policy