ProcessList: save scan time in millisecond

The delay is saved in deciseconds, use a bigger resolution to avoid
timing irregularities.
This commit is contained in:
Christian Göttsche 2020-12-13 13:18:38 +01:00 committed by BenBE
parent 26993d2d2b
commit 27b8d81ed2
2 changed files with 5 additions and 3 deletions

View File

@ -454,7 +454,7 @@ void Process_toggleTag(Process* this) {
bool Process_isNew(const Process* this) { bool Process_isNew(const Process* this) {
assert(this->processList); assert(this->processList);
if (this->processList->scanTs >= this->seenTs) { if (this->processList->scanTs >= this->seenTs) {
return this->processList->scanTs - this->seenTs <= this->processList->settings->highlightDelaySecs; return this->processList->scanTs - this->seenTs <= 1000 * this->processList->settings->highlightDelaySecs;
} }
return false; return false;
} }

View File

@ -539,7 +539,9 @@ void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate) {
this->scanTs = 0; this->scanTs = 0;
firstScanDone = true; firstScanDone = true;
} else if (Compat_clock_monotonic_gettime(&now) == 0) { } else if (Compat_clock_monotonic_gettime(&now) == 0) {
this->scanTs = now.tv_sec + now.tv_nsec / 1000000000; // save time in millisecond, so with a delay in deciseconds
// there are no irregularities
this->scanTs = 1000 * now.tv_sec + now.tv_nsec / 1000000;
} }
ProcessList_goThroughEntries(this, false); ProcessList_goThroughEntries(this, false);
@ -555,7 +557,7 @@ void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate) {
// process no longer exists // process no longer exists
if (this->settings->highlightChanges && p->wasShown) { if (this->settings->highlightChanges && p->wasShown) {
// mark tombed // mark tombed
p->tombTs = this->scanTs + this->settings->highlightDelaySecs; p->tombTs = this->scanTs + 1000 * this->settings->highlightDelaySecs;
} else { } else {
// immediately remove // immediately remove
ProcessList_remove(this, p); ProcessList_remove(this, p);