From bfe74b8ca7c28bd69c13ed88e14eee43f2786a47 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 7 Jan 2012 14:07:38 -0500 Subject: [PATCH] ctf-text: show timestamp in sec.nsec Signed-off-by: Mathieu Desnoyers --- formats/ctf-text/ctf-text.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/formats/ctf-text/ctf-text.c b/formats/ctf-text/ctf-text.c index 1b3e4bc7..19e92fca 100644 --- a/formats/ctf-text/ctf-text.c +++ b/formats/ctf-text/ctf-text.c @@ -34,6 +34,8 @@ #include #include +#define NSEC_PER_SEC 1000000000ULL + int opt_all_field_names, opt_scope_field_names, opt_header_field_names, @@ -179,12 +181,17 @@ int ctf_text_write_event(struct stream_pos *ppos, } if (stream->has_timestamp) { + uint64_t ts_sec, ts_nsec; + + ts_sec = stream->timestamp / NSEC_PER_SEC; + ts_nsec = stream->timestamp % NSEC_PER_SEC; set_field_names_print(pos, ITEM_HEADER); if (pos->print_names) fprintf(pos->fp, "timestamp = "); else fprintf(pos->fp, "["); - fprintf(pos->fp, "%12" PRIu64, stream->timestamp); + fprintf(pos->fp, "%3" PRIu64 ".%09" PRIu64, + ts_sec, ts_nsec); if (!pos->print_names) fprintf(pos->fp, "]"); -- 2.34.1