perf tools: Cast (struct timeval).tv_sec when printing

The musl-libc [1] defines (struct timeval).tv_sec as a 'long long' for
arm and other architectures. The default build having a '-Wformat' flag,
not casting the field when printing prevents from building perf.

This patch casts the (struct timeval).tv_sec fields to the expected
format.

[1] git://git.musl-libc.org/musl

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Douglas.raillard@arm.com
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210224182410.5366-1-Pierre.Gondois@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Pierre Gondois
2021-02-24 18:24:10 +00:00
committed by Arnaldo Carvalho de Melo
parent 21b7e35bdf
commit ded2e511a8
5 changed files with 9 additions and 9 deletions

View File

@@ -1618,8 +1618,8 @@ static void print_clock_data(struct feat_fd *ff, FILE *fp)
fprintf(fp, "# clockid: %s (%u)\n", clockid_name(clockid), clockid);
fprintf(fp, "# reference time: %s = %ld.%06d (TOD) = %ld.%09ld (%s)\n",
tstr, tod_ns.tv_sec, (int) tod_ns.tv_usec,
clockid_ns.tv_sec, clockid_ns.tv_nsec,
tstr, (long) tod_ns.tv_sec, (int) tod_ns.tv_usec,
(long) clockid_ns.tv_sec, clockid_ns.tv_nsec,
clockid_name(clockid));
}