Skip to content
Permalink
Browse files

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 <alpi@oticon.com>
  • Loading branch information...
aescolar committed Aug 5, 2019
1 parent 13823b6 commit b7ee23bcc969149c101044c67f518bac77391bf8
Showing with 6 additions and 0 deletions.
  1. +6 −0 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;
}

0 comments on commit b7ee23b

Please sign in to comment.
You can’t perform that action at this time.