lib: posix: Fix integer overflow in timer_gettime
Fix 'Unintentional integer overflow' coverity issue
in timer_gettime().
Coverity-CID: 183038
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
diff --git a/lib/posix/timer.c b/lib/posix/timer.c
index 3863abf..225fb7c 100644
--- a/lib/posix/timer.c
+++ b/lib/posix/timer.c
@@ -103,7 +103,7 @@
remaining = k_timer_remaining_get(&timer->ztimer);
secs = remaining / MSEC_PER_SEC;
leftover = remaining - (secs * MSEC_PER_SEC);
- nsecs = leftover * NSEC_PER_MSEC;
+ nsecs = (s64_t)leftover * NSEC_PER_MSEC;
its->it_value.tv_sec = (s32_t) secs;
its->it_value.tv_nsec = (s32_t) nsecs;
} else {