From: "Steven Rostedt (Red Hat)" Instead of using 1000000, define a USECS_PER_SEC macro and use that instead. Link: http://lkml.kernel.org/r/20160209204237.006667394@goodmis.org Signed-off-by: Steven Rostedt --- tools/lib/traceevent/event-parse.c | 4 ++-- tools/lib/traceevent/event-parse.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index d6f3cc0a29b0..2b85b339f6b9 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -5465,8 +5465,8 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s, } else { usecs = (nsecs + 500) / NSECS_PER_USEC; /* To avoid usecs larger than 1 sec */ - if (usecs >= 1000000) { - usecs -= 1000000; + if (usecs >= USECS_PER_SEC) { + usecs -= USECS_PER_SEC; secs++; } p = 6; diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 41b3d2238ed3..b09dd49465b0 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h @@ -175,6 +175,8 @@ struct pevent_plugin_option { #define NSECS_PER_SEC 1000000000ULL #define NSECS_PER_USEC 1000ULL +#define USECS_PER_SEC 1000000ULL + enum format_flags { FIELD_IS_ARRAY = 1, FIELD_IS_POINTER = 2, -- 2.10.2