From 38cd1da16c1f2c5dfe212fbb5b0a69aab394680e Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Thu, 26 Jun 2025 11:18:06 -0400 Subject: [PATCH] tests: lib: timespec_util: support tick period not multiples of 100ms If the system tick period is not a multiple of 100ms, then K_MSEC(100) does not correspond exactly to 100000000 ns after going through tick conversion. Convert 100ms to ticks and then to ns to account for this within the testsuite. Signed-off-by: Chris Friedt --- tests/lib/timespec_util/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/timespec_util/src/main.c b/tests/lib/timespec_util/src/main.c index f538a41e7256..fff309f0f3b4 100644 --- a/tests/lib/timespec_util/src/main.c +++ b/tests/lib/timespec_util/src/main.c @@ -298,7 +298,7 @@ static const struct tospec { {K_NSEC(2000000000), {2, 0}, 0}, {K_USEC(0), {0, 0}, 0}, {K_USEC(2000000), {2, 0}, 0}, - {K_MSEC(100), {0, 100000000}, 0}, + {K_MSEC(100), {0, k_ticks_to_ns_ceil64(k_ms_to_ticks_ceil32(100))}, 0}, {K_MSEC(2000), {2, 0}, 0}, {K_SECONDS(0), {0, 0}, 0}, {K_SECONDS(1), {1, 0}, 0},