From: Mikael Beckius Date: Tue, 12 May 2015 09:04:34 +0000 (+0200) Subject: Fix: live timer calculation error X-Git-Tag: v2.8.0-rc1~68 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f8921d33bfc7f2ec7370b12859064520653ccab0;p=lttng-ust.git Fix: live timer calculation error There is an calculation error for live timer. Variable chan->switch_timer_interval is based on microsecond, and it is not right to assign chan->switch_timer_interval mod 1000000 to var tv_nsec which is based on nanosecond. Signed-off-by: Mikael Beckius Signed-off-by: Jianchuan Wang Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/ring_buffer_frontend.c b/libringbuffer/ring_buffer_frontend.c index c7394b1f..53441aa5 100644 --- a/libringbuffer/ring_buffer_frontend.c +++ b/libringbuffer/ring_buffer_frontend.c @@ -642,7 +642,7 @@ void lib_ring_buffer_channel_switch_timer_start(struct channel *chan) } its.it_value.tv_sec = chan->switch_timer_interval / 1000000; - its.it_value.tv_nsec = chan->switch_timer_interval % 1000000; + its.it_value.tv_nsec = (chan->switch_timer_interval % 1000000) * 1000; its.it_interval.tv_sec = its.it_value.tv_sec; its.it_interval.tv_nsec = its.it_value.tv_nsec; @@ -696,7 +696,7 @@ void lib_ring_buffer_channel_read_timer_start(struct channel *chan) } its.it_value.tv_sec = chan->read_timer_interval / 1000000; - its.it_value.tv_nsec = chan->read_timer_interval % 1000000; + its.it_value.tv_nsec = (chan->read_timer_interval % 1000000) * 1000; its.it_interval.tv_sec = its.it_value.tv_sec; its.it_interval.tv_nsec = its.it_value.tv_nsec;