[fix] armclang cpp11 build error.

This commit is contained in:
guozhanxin 2021-10-13 16:02:36 +08:00
parent 0211f2fcc1
commit 8c4cdceb20
1 changed files with 13 additions and 1 deletions

View File

@ -73,7 +73,19 @@ extern "C" void __ARM_TPL_thread_yield()
extern "C" int __ARM_TPL_thread_nanosleep(const __ARM_TPL_timespec_t *__req, extern "C" int __ARM_TPL_thread_nanosleep(const __ARM_TPL_timespec_t *__req,
__ARM_TPL_timespec_t *__rem) __ARM_TPL_timespec_t *__rem)
{ {
return nanosleep(__req, rem); rt_tick_t tick;
tick = __req->tv_sec * RT_TICK_PER_SECOND + (__req->tv_nsec * RT_TICK_PER_SECOND)/ 1000000000;
rt_thread_delay(tick);
if (__rem)
{
tick = rt_tick_get() - tick;
/* get the passed time */
__rem->tv_sec = tick/RT_TICK_PER_SECOND;
__rem->tv_nsec = (tick%RT_TICK_PER_SECOND) * (1000000000/RT_TICK_PER_SECOND);
}
return 0;
} }
extern "C" unsigned __ARM_TPL_thread_hw_concurrency() extern "C" unsigned __ARM_TPL_thread_hw_concurrency()