From 91fe5ec1b8c551d921cf1d2b071f1f245615308b Mon Sep 17 00:00:00 2001 From: ryancw <1831931681@qq.com> Date: Tue, 29 Oct 2024 16:32:53 +0800 Subject: [PATCH] =?UTF-8?q?[src][clock]=20RT=5FTICK=5FPER=5FSECOND?= =?UTF-8?q?=E4=B8=BA1000=E6=97=B6tick=E4=B8=8D=E7=94=A8=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/clock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/clock.c b/src/clock.c index a29c0ad1cd..5ebfd83435 100644 --- a/src/clock.c +++ b/src/clock.c @@ -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 */