mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-03-20 11:11:08 +01:00
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 <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user