From: Mathieu Desnoyers Date: Tue, 13 Mar 2012 20:09:52 +0000 (-0400) Subject: Ensure that multiplication of clock offset is done on 64-bit X-Git-Tag: v2.0.0-rc3~4 X-Git-Url: http://git.lttng.org/?p=lttng-ust.git;a=commitdiff_plain;h=17ec046afa9b641b95951ca9594c3b7351d5e658 Ensure that multiplication of clock offset is done on 64-bit This is not a bug in UST per se, because we happen to force multiplication by a ULL number, but force cast to uint64_t anyway to ensure we don't trigger this overflow if the constant ever happen to change. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index d9bf555a..2b06f3c0 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -1088,7 +1088,7 @@ uint64_t measure_clock_offset(void) return 0; monotonic[1] = trace_clock_read64(); offset = (monotonic[0] + monotonic[1]) >> 1; - realtime = rts.tv_sec * 1000000000ULL; + realtime = (uint64_t) rts.tv_sec * 1000000000ULL; realtime += rts.tv_nsec; offset = realtime - offset; return offset;