From 69f60d21c627ad2fcae6d25fecf91e639c6ded33 Mon Sep 17 00:00:00 2001 From: Mikael Beckius Date: Wed, 21 Oct 2015 15:48:29 -0400 Subject: [PATCH] Fix live timer calculation error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit There is an calculation error for live timer. Variable switch_timer_interval is based on microsecond, and it is not right to assign 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: Jérémie Galarneau --- src/common/consumer/consumer-timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/consumer/consumer-timer.c b/src/common/consumer/consumer-timer.c index 3c9b3feb7..931f7471f 100644 --- a/src/common/consumer/consumer-timer.c +++ b/src/common/consumer/consumer-timer.c @@ -437,7 +437,7 @@ void consumer_timer_switch_start(struct lttng_consumer_channel *channel, channel->switch_timer_enabled = 1; its.it_value.tv_sec = switch_timer_interval / 1000000; - its.it_value.tv_nsec = switch_timer_interval % 1000000; + its.it_value.tv_nsec = (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; @@ -494,7 +494,7 @@ void consumer_timer_live_start(struct lttng_consumer_channel *channel, channel->live_timer_enabled = 1; its.it_value.tv_sec = live_timer_interval / 1000000; - its.it_value.tv_nsec = live_timer_interval % 1000000; + its.it_value.tv_nsec = (live_timer_interval % 1000000) * 1000; its.it_interval.tv_sec = its.it_value.tv_sec; its.it_interval.tv_nsec = its.it_value.tv_nsec; -- 2.34.1