Change in osmo-bsc[master]: switch handover penalty timers to CLOCK_MONOTONIC

neels gerrit-no-reply at
Thu Jul 15 09:28:19 UTC 2021

neels has submitted this change. ( )

Change subject: switch handover penalty timers to CLOCK_MONOTONIC

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"

Related: SYS#5198
Change-Id: Ifb1ab3165db50511aed4f65aa445798367d7e19e
M src/osmo-bsc/penalty_timers.c
1 file changed, 4 insertions(+), 4 deletions(-)

  daniel: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified

diff --git a/src/osmo-bsc/penalty_timers.c b/src/osmo-bsc/penalty_timers.c
index 6890061..124a362 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.

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ifb1ab3165db50511aed4f65aa445798367d7e19e
Gerrit-Change-Number: 24932
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at>
Gerrit-Reviewer: neels <nhofmeyr at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list