]> git.lttng.org Git - lttng-ust.git/commitdiff
Ensure that multiplication of clock offset is done on 64-bit
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 13 Mar 2012 20:09:52 +0000 (16:09 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 13 Mar 2012 20:09:52 +0000 (16:09 -0400)
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 <mathieu.desnoyers@efficios.com>
liblttng-ust/ltt-events.c

index d9bf555a9869c52af3f0dc550b6d74ee45c320a1..2b06f3c0bcb50be40de644158372d25fed82e707 100644 (file)
@@ -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;
This page took 0.031346 seconds and 4 git commands to generate.