sys_clock: Change function signature
__ticks_to_ms always return an unsigned value, changing the function to reflect it. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
f1f82a8dae
commit
4323243c62
1 changed files with 4 additions and 6 deletions
|
@ -125,23 +125,21 @@ static ALWAYS_INLINE s32_t _ms_to_ticks(s32_t ms)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline s64_t __ticks_to_ms(s64_t ticks)
|
||||
static inline u64_t __ticks_to_ms(s64_t ticks)
|
||||
{
|
||||
#ifdef CONFIG_SYS_CLOCK_EXISTS
|
||||
|
||||
#ifdef _NEED_PRECISE_TICK_MS_CONVERSION
|
||||
/* use 64-bit math to keep precision */
|
||||
return (u64_t)ticks * MSEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||
return (u64_t)ticks * MSEC_PER_SEC / (u64_t)CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||
#else
|
||||
/* simple multiplication keeps precision */
|
||||
u32_t ms_per_tick = MSEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||
|
||||
return (u64_t)ticks * ms_per_tick;
|
||||
return (u64_t)ticks * MSEC_PER_SEC / (u64_t)CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||
#endif
|
||||
|
||||
#else
|
||||
__ASSERT(ticks == 0, "ticks not zero");
|
||||
return 0;
|
||||
return 0ULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue