diff options
author | arza <arza@arza.us> | 2022-10-20 17:20:51 +0300 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2023-07-31 09:50:04 +0200 |
commit | 78c7b1c86bee3c188b3fe7acbbde548b34c9340a (patch) | |
tree | bab4fa201b9d12e32c502bace0701d4c6d90a55b /Process.c | |
parent | 5558c015f6699c9da47d1cb871318c23dedd4919 (diff) |
Show year as start time for processes older than a year
Diffstat (limited to 'Process.c')
-rw-r--r-- | Process.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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); } /* |