From: Mathieu Desnoyers Date: Sat, 7 Jan 2012 19:07:38 +0000 (-0500) Subject: ctf-text: show timestamp in sec.nsec X-Git-Tag: v0.9~39 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=bfe74b8ca7c28bd69c13ed88e14eee43f2786a47 ctf-text: show timestamp in sec.nsec Signed-off-by: Mathieu Desnoyers --- 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, "]");