switch handover penalty timers to CLOCK_MONOTONIC

To be able to add a fake time to handover tests, the penalty timers need
to use an osmo_* time source.

There already is a fixme comment rightfully asking for a monotonic
clock, so this change is overdue anyway.

An upcoming patch will prove that this works:
"handover tests: test passing of penalty timeout"
I65e59cc7309778cf9d71612669ce84d101c8135e

Related: SYS#5198
Change-Id: Ifb1ab3165db50511aed4f65aa445798367d7e19e
This commit is contained in:
Neels Hofmeyr 2021-07-13 23:35:31 +02:00 committed by neels
parent 1d9e758e76
commit 70d08b00ab
1 changed files with 4 additions and 4 deletions

View File

@ -30,10 +30,10 @@
static unsigned int time_now(void)
{
time_t now;
time(&now);
/* FIXME: use monotonic clock */
return (unsigned int)now;
struct timespec tp;
if (osmo_clock_gettime(CLOCK_MONOTONIC, &tp))
return 0;
return (unsigned int)tp.tv_sec;
}
/* Add a penalty timer for a target cell ID.