diff options
author | Peter Wemm <peter@FreeBSD.org> | 2002-11-15 22:42:00 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2002-11-15 22:42:00 +0000 |
commit | 6ceeb6902a155dfa35c39a3d360736584fbefb7f (patch) | |
tree | 414badc6420598c8e62302e330f16ee827afd3eb /usr.bin/who | |
parent | cdf5e9ccb6eb735c178354b575d894b0580ee560 (diff) |
utmp.ut_time and lastlog.ll_time are explicitly int32_t rather than
time_t. Deal with the possibility that time_t != int32_t. This boils
down to this sort of thing:
- time(&ut.ut_time);
+ ut.ut_time = time(NULL);
and similar for ctime(3) etc. I've kept it minimal for the stuff
that may need to be portable (or 3rd party code), but used Matt's time32
stuff for cases where that isn't as much of a concern.
Approved by: re (jhb)
Notes
Notes:
svn path=/head/; revision=106966
Diffstat (limited to 'usr.bin/who')
-rw-r--r-- | usr.bin/who/who.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c index 000cc21de12a..23c7608ba315 100644 --- a/usr.bin/who/who.c +++ b/usr.bin/who/who.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> #include <time.h> +#include <timeconv.h> #include <unistd.h> #include <utmp.h> @@ -160,7 +161,7 @@ row(struct utmp *ut) { char buf[80], tty[sizeof(_PATH_DEV) + UT_LINESIZE]; struct stat sb; - time_t idle; + time_t idle, t; static int d_first = -1; struct tm *tm; char state; @@ -184,7 +185,8 @@ row(struct utmp *ut) if (Tflag) printf("%c ", state); printf("%-*.*s ", UT_LINESIZE, UT_LINESIZE, ut->ut_line); - tm = localtime(&ut->ut_time); + t = _time32_to_time(ut->ut_time); + tm = localtime(&t); strftime(buf, sizeof(buf), d_first ? "%e %b %R" : "%b %e %R", tm); printf("%-*s ", 12, buf); if (uflag) { @@ -265,7 +267,7 @@ whoami(FILE *fp) name = "?"; strncpy(ut.ut_name, name, UT_NAMESIZE); strncpy(ut.ut_line, tty, UT_LINESIZE); - time(&ut.ut_time); + ut.ut_time = _time_to_time32(time(NULL)); row(&ut); } |