From 212fe157863695dd526be6320ddc84ce6ff5d392 Mon Sep 17 00:00:00 2001 From: "Martine S. Lenders" Date: Thu, 9 Apr 2020 23:21:42 +0200 Subject: [PATCH] xtimer: set now pointer correctly in _update_short_timers() loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes `xtimer` to use `xtimer_now64()` instead of `xtimer_now()` for updating the `*now` variable during the iteration in `_update_short_timers()` function. The same function is used to initialize `*now` in `_timer_callback()` below. While using `xtimer_now()` in this iteration step does not hinder the proper execution of all timers in the short term timers (for those the `xtimer` module only looks at the `start_time` member, not the `long_start_time` member) at least for the current long term time window (I did not test higher cases), it sets the `long_start_time` member to 0 for all timers following in the list of timers after this iteration step. However, external modules that rely on this to be correct, e.g. evtimer [1], fail their calculations when trying to compare to the current value to `xtimer_now64()`. [1] https://github.com/RIOT-OS/RIOT/blob/11f3d68/sys/evtimer/evtimer.c#L118-L121 Co-Authored-By: Cenk Gündoğan --- sys/xtimer/xtimer_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/xtimer/xtimer_core.c b/sys/xtimer/xtimer_core.c index cdc34ffcac..236a6f0408 100644 --- a/sys/xtimer/xtimer_core.c +++ b/sys/xtimer/xtimer_core.c @@ -292,7 +292,7 @@ static inline void _update_short_timers(uint64_t *now) /* assign new head */ timer = timer_list_head; /* update current_time */ - *now = _xtimer_now(); + *now = _xtimer_now64(); } else { timer->offset -= elapsed;