From 633a0e76a2fbb31ce6dd4dadb35313aed3aa385c Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Sep 2016 04:24:38 +0200 Subject: fix timer_test: don't forget to set tv_usec on the stop time The timer_test schedules timers and records the desired stop time. Also store the usec value of the desired stop time, because scheduling at e.g. sec N usec 999999 but recording sec N usec 0, and then receiving a timer at sec N+1 usec 0 is only 1 usec late, but records as 1000000 usecs late. This might have been the main cause of the timer test not working well on the osmocom build server. Change-Id: I13bb60f7d341a397f95d13d9c63c40188b6cd5a0 --- tests/timer/timer_test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/timer/timer_test.c b/tests/timer/timer_test.c index 6184f667..4981fd52 100644 --- a/tests/timer/timer_test.c +++ b/tests/timer/timer_test.c @@ -95,6 +95,7 @@ static void main_timer_fired(void *data) v->timer.data = v; unsigned int seconds = (random() % 10) + 1; v->stop.tv_sec = v->start.tv_sec + seconds; + v->stop.tv_usec = v->start.tv_usec; osmo_timer_schedule(&v->timer, seconds, 0); llist_add(&v->head, &timer_test_list); } -- cgit v1.2.3