diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-04-25 03:14:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-04-25 03:14:47 +0000 |
commit | 10bab5c18ebf12d04481d4039e25d1ec96fe6e78 (patch) | |
tree | cf1b2878d74dae8b55c98bcd4dff926bc46bcf32 /sbin | |
parent | 752bc0bc9843709ff347fd39d27268215776a5ee (diff) |
if the timeval has data, print it at the end of the line
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/sysctl/sysctl.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 7629faff549..66cbe9a4be9 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.137 2006/04/20 21:09:08 deraadt Exp $ */ +/* $OpenBSD: sysctl.c,v 1.138 2006/04/25 03:14:46 deraadt Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95"; #else -static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.137 2006/04/20 21:09:08 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.138 2006/04/25 03:14:46 deraadt Exp $"; #endif #endif /* not lint */ @@ -2213,6 +2213,18 @@ print_sensor(struct sensor *s) printf(", UNKNOWN"); break; } + + if (s->tv.tv_sec) { + time_t t = s->tv.tv_sec; + char *ct; + + ct = ctime(&t); + if (ct) { + ct = strdup(ct); + ct[19] = '\0'; + printf(", %s.%2f", ct, s->tv.tv_usec / 1000.0); + } + } } struct emulname { |