From b7ee23bcc969149c101044c67f518bac77391bf8 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 5 Aug 2019 13:42:58 +0200 Subject: [PATCH] nrf52_bsim: Minor fix in time coversion (This could not be triggered in the nrf52_bsim yet, so just so it is fixed for the future) Properly handle converting back and forth from absolute to HW time when either of those is set to TIME_NEVER Signed-off-by: Alberto Escolar Piedras --- boards/posix/nrf52_bsim/time_machine.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/boards/posix/nrf52_bsim/time_machine.c b/boards/posix/nrf52_bsim/time_machine.c index 10a42372a3b..fd8ebf73419 100644 --- a/boards/posix/nrf52_bsim/time_machine.c +++ b/boards/posix/nrf52_bsim/time_machine.c @@ -195,11 +195,17 @@ bs_time_t tm_get_next_timer_abstime(void) bs_time_t tm_hw_time_to_abs_time(bs_time_t hwtime) { + if (hwtime == TIME_NEVER) { + return TIME_NEVER; + } return hwtime + hw_time_delta; } bs_time_t tm_abs_time_to_hw_time(bs_time_t abstime) { + if (abstime == TIME_NEVER) { + return TIME_NEVER; + } return abstime - hw_time_delta; }