aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-07-13 23:35:31 +0200
committerneels <nhofmeyr@sysmocom.de>2021-07-15 09:28:18 +0000
commit70d08b00ab31f84f4c7e11c535bbcbfcf39a585b (patch)
tree648aa49b08b1a4a87c8a1e38eef84f0872aafa93
parent1d9e758e76679f7ca207d93b41212c22118a5b81 (diff)
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
-rw-r--r--src/osmo-bsc/penalty_timers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/osmo-bsc/penalty_timers.c b/src/osmo-bsc/penalty_timers.c
index 689006114..124a36255 100644
--- a/src/osmo-bsc/penalty_timers.c
+++ b/src/osmo-bsc/penalty_timers.c
@@ -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.