From 2393fddd60af7d5853c48745ae989f75f5ca3bee Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 2 Mar 2026 19:22:24 +0100 Subject: [PATCH] clock_gettime: don't assume more than 1 second since the origin of time With e.g. `CLOCK_BOOTTIME`, it's plausible that less than 1 second has passed since the boot reference time. Only assert that the returned time is nonzero (because all-bits-zero is highly implausible as an actual clock value, but likely indicates that the intended value was not copied out correctly). Signed-off-by: Gilles Peskine --- tests/suites/test_suite_platform_unix.function | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/suites/test_suite_platform_unix.function b/tests/suites/test_suite_platform_unix.function index d419390bf4..6646815962 100644 --- a/tests/suites/test_suite_platform_unix.function +++ b/tests/suites/test_suite_platform_unix.function @@ -52,7 +52,7 @@ void clock_gettime_available(int clockid) memset(&ts, 0, sizeof(ts)); int ret = clock_gettime(clockid, &ts); TEST_ASSERT_ERRNO(ret == 0); - TEST_LE_S(1, ts.tv_sec); + TEST_ASSERT(ts.tv_sec != 0 || ts.tv_nsec != 0); } /* END_CASE */