summaryrefslogtreecommitdiffstats
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-06-06 21:21:25 +0000
committerjmallett <jmallett@FreeBSD.org>2002-06-06 21:21:25 +0000
commitd11731ff431780a9d55268d2c478bdd517945657 (patch)
treed00aa5fbf24ccd496e1bb92817a26f8752ec7a80 /bin/ps/print.c
parentbecd81c4a9315cc0cfd6078a89434a5ed7091e28 (diff)
downloadFreeBSD-src-d11731ff431780a9d55268d2c478bdd517945657.zip
FreeBSD-src-d11731ff431780a9d55268d2c478bdd517945657.tar.gz
Use a global `now' variable for the current time, and initialise it at
startup, right after calling setlocale(3).
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c6
1 files changed, 0 insertions, 6 deletions
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);
OpenPOWER on IntegriCloud