Pretty plugin: only print negative timestamp warning once per component
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 17 Jul 2017 19:30:29 +0000 (15:30 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 18 Jul 2017 16:12:09 +0000 (12:12 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/text/pretty/pretty.h
plugins/text/pretty/print.c

index 272e06cff3a05f19784e5e1b81150cb5df2fb7b8..554fc72f8742523cb42feb2dccf992680c69a08e 100644 (file)
@@ -92,6 +92,8 @@ struct pretty_component {
 
        uint64_t last_real_timestamp;
        uint64_t delta_real_timestamp;
+
+       bool negative_timestamp_warning_done;
 };
 
 enum stream_packet_context_quarks_enum {
index e698f4bd6671e87e6cec52bc115e25d42068e03a..7cf9434d969fb550b36f66536453f7c511d06835 100644 (file)
@@ -191,9 +191,10 @@ void print_timestamp_wall(struct pretty_component *pretty,
                struct tm tm;
                time_t time_s = (time_t) ts_sec_abs;
 
-               if (is_negative) {
+               if (is_negative && !pretty->negative_timestamp_warning_done) {
                        // TODO: log instead
                        fprintf(stderr, "[warning] Fallback to [sec.ns] to print negative time value. Use --clock-seconds.\n");
+                       pretty->negative_timestamp_warning_done = true;
                        goto seconds;
                }
 
This page took 0.02644 seconds and 4 git commands to generate.