Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show year as start time for processes older than a year #1116

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Process.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,13 @@ void Process_printTime(RichString* str, unsigned long long totalHundredths, bool

void Process_fillStarttimeBuffer(Process* this) {
struct tm date;
time_t now = this->host->realtime.tv_sec;
(void) localtime_r(&this->starttime_ctime, &date);
strftime(this->starttime_show, sizeof(this->starttime_show) - 1, (this->starttime_ctime > (time(NULL) - 86400)) ? "%R " : "%b%d ", &date);

strftime(this->starttime_show,
sizeof(this->starttime_show) - 1,
(this->starttime_ctime > now - 86400) ? "%R " : (this->starttime_ctime > now - 364*86400) ? "%b%d " : " %Y ",
BenBE marked this conversation as resolved.
Show resolved Hide resolved
&date);
}

/*
Expand Down