[src][clock] RT_TICK_PER_SECOND为1000时tick不用进行转换

This commit is contained in:
ryancw 2024-10-29 16:32:53 +08:00 committed by Meco Man
parent 91eca8d573
commit 91fe5ec1b8
1 changed files with 4 additions and 0 deletions

View File

@ -205,8 +205,12 @@ rt_tick_t rt_tick_from_millisecond(rt_int32_t ms)
}
else
{
#if RT_TICK_PER_SECOND == 1000u
tick = ms;
#else
tick = RT_TICK_PER_SECOND * (ms / 1000);
tick += (RT_TICK_PER_SECOND * (ms % 1000) + 999) / 1000;
#endif /* RT_TICK_PER_SECOND == 1000u */
}
/* return the calculated tick */