From 781c27a98e0d7dbea1addd7ed8bbb330db121f05 Mon Sep 17 00:00:00 2001 From: cuiziwei Date: Fri, 3 Jan 2025 16:19:06 +0800 Subject: [PATCH] sim/oneshot: Remove redundant variables. Signed-off-by: cuiziwei --- arch/sim/src/sim/sim_oneshot.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/sim/src/sim/sim_oneshot.c b/arch/sim/src/sim/sim_oneshot.c index 5cf1bf4b9ef..6148cdea6ed 100644 --- a/arch/sim/src/sim/sim_oneshot.c +++ b/arch/sim/src/sim/sim_oneshot.c @@ -113,15 +113,10 @@ static const struct oneshot_operations_s g_oneshot_ops = static inline void sim_timer_current(struct timespec *ts) { - uint64_t nsec; - time_t sec; + uint64_t nsec = host_gettime(false); - nsec = host_gettime(false); - sec = nsec / NSEC_PER_SEC; - nsec -= sec * NSEC_PER_SEC; - - ts->tv_sec = sec; - ts->tv_nsec = nsec; + ts->tv_sec = nsec / NSEC_PER_SEC; + ts->tv_nsec = nsec % NSEC_PER_SEC; } /****************************************************************************