mirror of https://gerrit.osmocom.org/libosmocore
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
This commit is contained in:
parent
5b34f773e4
commit
633a0e76a2
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue