Fix: live timer calculation error
authorMikael Beckius <mikael.beckius@windriver.com>
Tue, 12 May 2015 09:04:34 +0000 (11:04 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 21 Oct 2015 19:43:39 +0000 (15:43 -0400)
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 <mikael.beckius@windriver.com>
Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
libringbuffer/ring_buffer_frontend.c

index 77019e9c3fce8e65159a4e7e7e73076b40719177..6c3fa740ba397ea005f605e998ffb1ce5f175e5e 100644 (file)
@@ -544,7 +544,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;
 
@@ -598,7 +598,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;
 
This page took 0.026322 seconds and 4 git commands to generate.