sig_timewait:changes the macro for waitticks

use SYSTEM_TIME64 inside of LONG LONG better

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-03-10 12:29:35 +08:00 committed by Xiang Xiao
parent 02aa7bcefe
commit 78bff8e9c5

View File

@ -242,7 +242,11 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
sigset_t intersection;
FAR sigpendq_t *sigpend;
irqstate_t flags;
#ifdef CONFIG_SYSTEM_TIME64
int64_t waitticks;
#else
int32_t waitticks;
#endif
bool switch_needed;
int ret;
@ -320,13 +324,11 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
* time in nanoseconds.
*/
#ifdef CONFIG_HAVE_LONG_LONG
uint64_t waitticks64 = ((uint64_t)timeout->tv_sec * NSEC_PER_SEC +
(uint64_t)timeout->tv_nsec +
NSEC_PER_TICK - 1) /
NSEC_PER_TICK;
DEBUGASSERT(waitticks64 <= UINT32_MAX);
waitticks = (uint32_t)waitticks64;
#ifdef CONFIG_SYSTEM_TIME64
waitticks = ((uint64_t)timeout->tv_sec * NSEC_PER_SEC +
(uint64_t)timeout->tv_nsec + NSEC_PER_TICK - 1) /
NSEC_PER_TICK;
DEBUGASSERT(waitticks <= UINT32_MAX);
#else
uint32_t waitmsec;