* @brief This function will return the passed millisecond from boot. * * @note if the value of RT_TICK_PER_SECOND is lower than 1000 or * is not an integral multiple of 1000, this function will not * provide the correct 1ms-based tick. * * @return Return passed millisecond from boot. */
| 244 | * @return Return passed millisecond from boot. |
| 245 | */ |
| 246 | rt_weak rt_tick_t rt_tick_get_millisecond(void) |
| 247 | { |
| 248 | #if RT_TICK_PER_SECOND == 0 /* make cppcheck happy*/ |
| 249 | #error "RT_TICK_PER_SECOND must be greater than zero" |
| 250 | #endif |
| 251 | |
| 252 | #if 1000 % RT_TICK_PER_SECOND == 0u |
| 253 | return rt_tick_get() * (1000u / RT_TICK_PER_SECOND); |
| 254 | #else |
| 255 | #warning "rt-thread cannot provide a correct 1ms-based tick any longer,\ |
| 256 | please redefine this function in another file by using a high-precision hard-timer." |
| 257 | return 0; |
| 258 | #endif /* 1000 % RT_TICK_PER_SECOND == 0u */ |
| 259 | } |
| 260 | |
| 261 | /**@}*/ |
no test coverage detected