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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Tue Jul 13 23:22:24 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24932 )


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"
I65e59cc7309778cf9d71612669ce84d101c8135e

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



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/32/24932/1

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 https://gerrit.osmocom.org/c/osmo-bsc/+/24932
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ifb1ab3165db50511aed4f65aa445798367d7e19e
Gerrit-Change-Number: 24932
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210713/d5bb0668/attachment.htm>


More information about the gerrit-log mailing list