From 114506b359d43fe47d1efad27f7db42fdfaf4701 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 15 Jun 2005 10:50:30 +0000 Subject: [PATCH] hcidump: Use human readable timestamps --- tools/parser/parser.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/parser/parser.h b/tools/parser/parser.h index 0352c09e8..193c9f2f1 100644 --- a/tools/parser/parser.h +++ b/tools/parser/parser.h @@ -27,6 +27,7 @@ #ifndef __PARSER_H #define __PARSER_H +#include #include #include #include @@ -112,8 +113,15 @@ static inline void p_indent(int level, struct frame *f) } if (!parser.state) { - if (parser.flags & DUMP_TSTAMP) - printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec); + if (parser.flags & DUMP_TSTAMP) { + struct tm tm; + time_t t = f->ts.tv_sec; + localtime_r(&t, &tm); + printf("%04d-%02d-%02d %02d:%02d:%02d.%06lu ", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, f->ts.tv_usec); + //printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec); + } printf("%c ", (f->in ? '>' : '<')); parser.state = 1; } else -- 2.47.3