summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2010-01-20 21:12:30 +0000
committerEd Schouten <ed@FreeBSD.org>2010-01-20 21:12:30 +0000
commitf9503ae0eef9bfb355d09fe6fdd14984c2ac7fa6 (patch)
tree7ae58fe3ac18d2caea8a88d4306622effbc3166a
parent8b72ee05e7598b516fdbe5a7d2bed1bf6842cad9 (diff)
downloadgetent-darwin-f9503ae0eef9bfb355d09fe6fdd14984c2ac7fa6.tar.gz
getent-darwin-f9503ae0eef9bfb355d09fe6fdd14984c2ac7fa6.tar.zst
getent-darwin-f9503ae0eef9bfb355d09fe6fdd14984c2ac7fa6.zip
Also print UNIX timestamps in getent utmpx output.
-rw-r--r--getent.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/getent.c b/getent.c
index e6e33a0..d19eac6 100644
--- a/getent.c
+++ b/getent.c
@@ -55,8 +55,9 @@ __FBSDID("$FreeBSD$");
#include <limits.h>
#include <netdb.h>
#include <pwd.h>
-#include <stdio.h>
#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -583,7 +584,9 @@ utmpxprint(const struct utmpx *ut)
if (ut->ut_type == EMPTY)
return;
- printf("[%.24s] ", ctime(&ut->ut_tv.tv_sec));
+ printf("[%jd.%06u -- %.24s] ",
+ (intmax_t)ut->ut_tv.tv_sec, (unsigned int)ut->ut_tv.tv_usec,
+ ctime(&ut->ut_tv.tv_sec));
switch (ut->ut_type) {
case BOOT_TIME: