summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormultiplexd <multiplexd@users.noreply.github.com>2018-08-19 05:09:08 +0100
committerHisham Muhammad <hisham@gobolinux.org>2018-08-24 16:01:38 -0300
commit03e0a73d5be1e7a605dd5c45ad8af060c8e249ac (patch)
treed80ffc621696bd114b6734a10070d368044bd0a9
parent794419e6c503f7c7f95305a99b2acdc1db6b90bd (diff)
OpenBSD: make the STARTTIME column display correctly (#815)
-rw-r--r--openbsd/OpenBSDProcessList.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c
index 14d9c2dc..e49cbd71 100644
--- a/openbsd/OpenBSDProcessList.c
+++ b/openbsd/OpenBSDProcessList.c
@@ -223,6 +223,8 @@ void ProcessList_goThroughEntries(ProcessList* this) {
bool preExisting;
Process* proc;
OpenBSDProcess* fp;
+ struct tm date;
+ struct timeval tv;
int count = 0;
int i;
@@ -232,6 +234,8 @@ void ProcessList_goThroughEntries(ProcessList* this) {
struct kinfo_proc* kprocs = kvm_getprocs(opl->kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
//struct kinfo_proc* kprocs = getprocs(KERN_PROC_ALL, 0, &count);
+ gettimeofday(&tv, NULL);
+
for (i = 0; i < count; i++) {
kproc = &kprocs[i];
@@ -254,6 +258,8 @@ void ProcessList_goThroughEntries(ProcessList* this) {
proc->user = UsersTable_getRef(this->usersTable, proc->st_uid);
ProcessList_add((ProcessList*)this, proc);
proc->comm = OpenBSDProcessList_readProcessName(opl->kd, kproc, &proc->basenameOffset);
+ (void) localtime_r((time_t*) &kproc->p_ustart_sec, &date);
+ strftime(proc->starttime_show, 7, ((proc->starttime_ctime > tv.tv_sec - 86400) ? "%R " : "%b%d "), &date);
} else {
if (settings->updateProcessNames) {
free(proc->comm);

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