We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9d88a8 commit 348bd83Copy full SHA for 348bd83
src/clock.c
@@ -107,15 +107,20 @@ void rt_tick_increase(void)
107
*
108
* @return the calculated tick
109
*/
110
-int rt_tick_from_millisecond(rt_int32_t ms)
+rt_tick_t rt_tick_from_millisecond(rt_int32_t ms)
111
{
112
- int tick;
+ rt_tick_t tick;
113
114
if (ms < 0)
115
+ {
116
tick = RT_WAITING_FOREVER;
117
+ }
118
else
- tick = (RT_TICK_PER_SECOND * ms + 999) / 1000;
-
119
120
+ tick = RT_TICK_PER_SECOND * (ms / 1000);
121
+ tick += (RT_TICK_PER_SECOND * (ms%1000) + 999) / 1000;
122
123
+
124
/* return the calculated tick */
125
return tick;
126
}
0 commit comments