From 78c7b1c86bee3c188b3fe7acbbde548b34c9340a Mon Sep 17 00:00:00 2001 From: arza Date: Thu, 20 Oct 2022 17:20:51 +0300 Subject: Show year as start time for processes older than a year --- Process.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Process.c') diff --git a/Process.c b/Process.c index 1424d6ef..3c60c8b8 100644 --- a/Process.c +++ b/Process.c @@ -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 = time(NULL); (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 ", + &date); } /* -- cgit v1.2.3