diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-22 04:24:38 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-22 07:18:39 +0200 |
commit | 633a0e76a2fbb31ce6dd4dadb35313aed3aa385c (patch) | |
tree | 88446505e438c5c7752a5d21c1910712440ac021 /tests/timer | |
parent | 5b34f773e441b984d3bc98468fd015eeb4131890 (diff) |
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
Diffstat (limited to 'tests/timer')
-rw-r--r-- | tests/timer/timer_test.c | 1 |
1 files changed, 1 insertions, 0 deletions
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); } |