summaryrefslogtreecommitdiffstats
path: root/bin/ps/ps.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/ps.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/ps.c')
-rw-r--r--bin/ps/ps.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 2a25c92..f808cd5 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -81,6 +81,8 @@ int sumrusage; /* -S */
int termwidth; /* width of screen (0 == infinity) */
int totwidth; /* calculated width of requested variables */
+time_t now; /* current time(3) value */
+
static int needuser, needcomm, needenv;
#if defined(LAZY_PS)
static int forceuread=0;
@@ -128,6 +130,8 @@ main(int argc, char *argv[])
const char *nlistf, *memf;
(void) setlocale(LC_ALL, "");
+ /* Set the time to what it is right now. */
+ time(&now);
if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0')
termwidth = atoi(cols);
OpenPOWER on IntegriCloud