mesh: glue: Fix calculating remaining time of delayed work

os_cputime_get32() returns value from totally different range, than
os_time_get() and os_callout_reset() uses os_time_get(), so it should be
also used here. os_cputime_ticks_to_usecs() doesn't work well with
os_time_get(), so OS_TICKS_PER_SEC macro is used.

X-Original-Commit: 1eb0d588b403935a8451ff8d87a9b5c993282e3c
This commit is contained in:
Michał Narajowski
2018-02-14 12:07:37 +01:00
parent 9b080e3657
commit 3dc586db13
+2 -2
View File
@@ -370,12 +370,12 @@ k_delayed_work_remaining_get (struct k_delayed_work *w)
OS_ENTER_CRITICAL(sr);
t = os_callout_remaining_ticks(&w->work, os_cputime_get32());
t = os_callout_remaining_ticks(&w->work, os_time_get());
OS_EXIT_CRITICAL(sr);
/* We should return ms */
return os_cputime_ticks_to_usecs(t) / 1000;
return t / OS_TICKS_PER_SEC * 1000;
}
int64_t k_uptime_get(void)