timer: Fix implementation of osmo_timers_nearest causing high CPU load
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
diff --git a/src/timer.c b/src/timer.c
index 6852983..d1a4e7e 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -132,12 +132,10 @@
*/
struct timeval *osmo_timers_nearest(void)
{
- static struct timeval no_timers = { 0, 0 };
-
- if (nearest_p != NULL && !timerisset(nearest_p))
+ if (nearest_p != NULL)
return nearest_p;
else
- return &no_timers;
+ return NULL;
}
static void update_nearest(struct timeval *cand, struct timeval *current)