<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/24932">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">switch handover penalty timers to CLOCK_MONOTONIC<br><br>To be able to add a fake time to handover tests, the penalty timers need<br>to use an osmo_* time source.<br><br>There already is a fixme comment rightfully asking for a monotonic<br>clock, so this change is overdue anyway.<br><br>An upcoming patch will prove that this works:<br>"handover tests: test passing of penalty timeout"<br>I65e59cc7309778cf9d71612669ce84d101c8135e<br><br>Related: SYS#5198<br>Change-Id: Ifb1ab3165db50511aed4f65aa445798367d7e19e<br>---<br>M src/osmo-bsc/penalty_timers.c<br>1 file changed, 4 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/32/24932/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/penalty_timers.c b/src/osmo-bsc/penalty_timers.c</span><br><span>index 6890061..124a362 100644</span><br><span>--- a/src/osmo-bsc/penalty_timers.c</span><br><span>+++ b/src/osmo-bsc/penalty_timers.c</span><br><span>@@ -30,10 +30,10 @@</span><br><span> </span><br><span> static unsigned int time_now(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-  time_t now;</span><br><span style="color: hsl(0, 100%, 40%);">-     time(&now);</span><br><span style="color: hsl(0, 100%, 40%);">- /* FIXME: use monotonic clock */</span><br><span style="color: hsl(0, 100%, 40%);">-        return (unsigned int)now;</span><br><span style="color: hsl(120, 100%, 40%);">+     struct timespec tp;</span><br><span style="color: hsl(120, 100%, 40%);">+   if (osmo_clock_gettime(CLOCK_MONOTONIC, &tp))</span><br><span style="color: hsl(120, 100%, 40%);">+             return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     return (unsigned int)tp.tv_sec;</span><br><span> }</span><br><span> </span><br><span> /* Add a penalty timer for a target cell ID.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/24932">change 24932</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/24932"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ifb1ab3165db50511aed4f65aa445798367d7e19e </div>
<div style="display:none"> Gerrit-Change-Number: 24932 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>