summaryrefslogtreecommitdiff
path: root/components/libc/compilers
diff options
context:
space:
mode:
authorzhkag <[email protected]>2022-12-08 23:02:40 +0800
committerGitHub <[email protected]>2022-12-08 10:02:40 -0500
commit2e488e04401a00143416075fbd9598d1a810aade (patch)
tree4e9db36aac39140666730193d2ad68449afe36ef /components/libc/compilers
parent50d5046f13a0045de87dab6de9fa3d3ffcecccaf (diff)
[rt-smart]同步 gitee nanosleep 修复 (#6710)
Diffstat (limited to 'components/libc/compilers')
-rw-r--r--components/libc/compilers/common/ctime.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c
index 493b502534..ace480a54b 100644
--- a/components/libc/compilers/common/ctime.c
+++ b/components/libc/compilers/common/ctime.c
@@ -727,7 +727,7 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
case CLOCK_REALTIME:
{
rt_tick_t tick, tick_old = rt_tick_get();
- if (flags & TIMER_ABSTIME == TIMER_ABSTIME)
+ if ((flags & TIMER_ABSTIME) == TIMER_ABSTIME)
{
tick = (rqtp->tv_sec - _timevalue.tv_sec) * RT_TICK_PER_SECOND + (rqtp->tv_nsec - _timevalue.tv_usec) * (RT_TICK_PER_SECOND / NANOSECOND_PER_SECOND);
rt_tick_t rt_tick = rt_tick_get();
@@ -763,7 +763,7 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
float unit = clock_cpu_getres();
cpu_tick = (rqtp->tv_sec * NANOSECOND_PER_SECOND + rqtp->tv_nsec * (NANOSECOND_PER_SECOND / NANOSECOND_PER_SECOND)) / unit;
- if (flags & TIMER_ABSTIME == TIMER_ABSTIME)
+ if ((flags & TIMER_ABSTIME) == TIMER_ABSTIME)
cpu_tick = cpu_tick < cpu_tick_old ? 0 : cpu_tick - cpu_tick_old;
tick = (unit * cpu_tick) / (NANOSECOND_PER_SECOND / RT_TICK_PER_SECOND);
rt_thread_delay(tick);
@@ -1007,7 +1007,6 @@ RTM_EXPORT(timer_delete);
**/
int timer_getoverrun(timer_t timerid)
{
- struct timer_obj *timer = (struct timer_obj *)((uintptr_t)timerid << 1);
rt_set_errno(ENOSYS);
return -RT_ERROR;
}
@@ -1125,7 +1124,7 @@ int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
* RT_TICK_PER_SECOND NANOSECOND_PER_SECOND NANOSECOND_PER_SECOND
*
*/
- if (flags & TIMER_ABSTIME == TIMER_ABSTIME)
+ if ((flags & TIMER_ABSTIME) == TIMER_ABSTIME)
{
#ifndef RT_USING_RTC
LOG_W(_WARNING_NO_RTC);