summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-08-29 00:24:45 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-08-29 00:24:45 +0000
commitcde74aaa7bc0ddb028c488984862887a1d9d7114 (patch)
tree806e46652323e25c861ce8206becf99808471f8a /usr.bin
parent963721f56e1fac34a6ab29cd2ff2b9466b5090e8 (diff)
Microseconds in log time.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/log.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/tmux/log.c b/usr.bin/tmux/log.c
index 14689f3e343..6a4e77ecd8d 100644
--- a/usr.bin/tmux/log.c
+++ b/usr.bin/tmux/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.13 2015/08/28 12:15:54 nicm Exp $ */
+/* $OpenBSD: log.c,v 1.14 2015/08/29 00:24:44 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -66,14 +66,15 @@ log_close(void)
void
log_vwrite(const char *msg, va_list ap)
{
- char *fmt;
- time_t t;
+ char *fmt;
+ struct timeval tv;
if (log_file == NULL)
return;
- t = time(NULL);
- if (asprintf(&fmt, "%lld %s\n", (long long)t, msg) == -1)
+ gettimeofday(&tv, NULL);
+ if (asprintf(&fmt, "%lld.%06d %s\n", (long long)tv.tv_sec,
+ (int)tv.tv_usec, msg) == -1)
exit(1);
if (vfprintf(log_file, fmt, ap) == -1)
exit(1);