summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Crowston <crowston@protonmail.com>2019-12-29 02:10:36 +0000
committerRobert Crowston <crowston@protonmail.com>2019-12-31 19:28:23 +0000
commit87c05ac136ac31647282009f474b6f62b1cc0a17 (patch)
treeb79f34205d2d1adede5e8ecafdb6237b099e5e75
parent402e46bb82964366746b86d77eb5afa69c279539 (diff)
Fix STARTTIME column on FreeBSD.
-rw-r--r--freebsd/FreeBSDProcessList.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c
index 9fef324a..ccacf9d4 100644
--- a/freebsd/FreeBSDProcessList.c
+++ b/freebsd/FreeBSDProcessList.c
@@ -18,6 +18,7 @@ in the source distribution for its full text.
#include <fcntl.h>
#include <limits.h>
#include <string.h>
+#include <time.h>
/*{
@@ -429,10 +430,14 @@ void ProcessList_goThroughEntries(ProcessList* this) {
int count = 0;
struct kinfo_proc* kprocs = kvm_getprocs(fpl->kd, KERN_PROC_PROC, 0, &count);
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+
for (int i = 0; i < count; i++) {
struct kinfo_proc* kproc = &kprocs[i];
bool preExisting = false;
bool isIdleProcess = false;
+ struct tm date;
Process* proc = ProcessList_getProcess(this, kproc->ki_pid, &preExisting, (Process_New) FreeBSDProcess_new);
FreeBSDProcess* fp = (FreeBSDProcess*) proc;
@@ -523,6 +528,9 @@ void ProcessList_goThroughEntries(ProcessList* this) {
this->kernelThreads++;
}
+ (void) localtime_r((time_t*) &proc->starttime_ctime, &date);
+ strftime(proc->starttime_show, 7, ((proc->starttime_ctime > tv.tv_sec - 86400) ? "%R " : "%b%d "), &date);
+
this->totalTasks++;
if (proc->state == 'R')
this->runningTasks++;

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