Change clock source to boottime on linux.

CLOCK_MONOTONIC does not account for time when suspend.
And CLOCK_BOOTTIME does it.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2023-04-20 17:11:32 +08:00
parent 3c3b94a31b
commit 5cc39a6a9d

View File

@ -235,7 +235,11 @@ mbedtls_ms_time_t mbedtls_ms_time(void)
struct timespec tv;
mbedtls_ms_time_t current_ms;
#if defined(__linux__)
ret = clock_gettime(CLOCK_BOOTTIME, &tv);
#else
ret = clock_gettime(CLOCK_MONOTONIC, &tv);
#endif
if (ret) {
return time(NULL) * 1000;
}