From d11731ff431780a9d55268d2c478bdd517945657 Mon Sep 17 00:00:00 2001 From: jmallett Date: Thu, 6 Jun 2002 21:21:25 +0000 Subject: Use a global `now' variable for the current time, and initialise it at startup, right after calling setlocale(3). --- bin/ps/print.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'bin/ps/print.c') diff --git a/bin/ps/print.c b/bin/ps/print.c index 4f43aa4..7864cae 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -376,7 +376,6 @@ void started(KINFO *k, VARENT *ve) { VAR *v; - static time_t now; time_t then; struct tm *tp; char buf[100]; @@ -393,8 +392,6 @@ started(KINFO *k, VARENT *ve) then = k->ki_p->ki_start.tv_sec; tp = localtime(&then); - if (!now) - (void)time(&now); if (now - k->ki_p->ki_start.tv_sec < 24 * 3600) { (void)strftime(buf, sizeof(buf) - 1, use_ampm ? "%l:%M%p" : "%k:%M ", tp); @@ -541,12 +538,9 @@ elapsed(KINFO *k, VARENT *ve) VAR *v; time_t secs; char obuff[128]; - static time_t now; v = ve->var; - if (!now) - time(&now); secs = now - k->ki_p->ki_start.tv_sec; (void)snprintf(obuff, sizeof(obuff), "%3ld:%02ld", secs/60, secs%60); (void)printf("%*s", v->width, obuff); -- cgit v1.1