mirror of https://github.com/tmux/tmux.git
Microseconds in log time.
parent
d9b3133321
commit
73bd816076
9
log.c
9
log.c
|
@ -66,14 +66,15 @@ log_close(void)
|
||||||
void
|
void
|
||||||
log_vwrite(const char *msg, va_list ap)
|
log_vwrite(const char *msg, va_list ap)
|
||||||
{
|
{
|
||||||
char *fmt;
|
char *fmt;
|
||||||
time_t t;
|
struct timeval tv;
|
||||||
|
|
||||||
if (log_file == NULL)
|
if (log_file == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t = time(NULL);
|
gettimeofday(&tv, NULL);
|
||||||
if (asprintf(&fmt, "%lld %s\n", (long long)t, msg) == -1)
|
if (asprintf(&fmt, "%lld.%06d %s\n", (long long)tv.tv_sec,
|
||||||
|
(int)tv.tv_usec, msg) == -1)
|
||||||
exit(1);
|
exit(1);
|
||||||
if (vfprintf(log_file, fmt, ap) == -1)
|
if (vfprintf(log_file, fmt, ap) == -1)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in New Issue