diff --git a/tests/posix/common/src/mutex.c b/tests/posix/common/src/mutex.c index 40987d50297a0..20b992620eb8a 100644 --- a/tests/posix/common/src/mutex.c +++ b/tests/posix/common/src/mutex.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -182,7 +183,7 @@ static void *test_mutex_timedlock_fn(void *arg) struct timespec time_point; pthread_mutex_t *mtx = (pthread_mutex_t *)arg; - zassume_ok(clock_gettime(CLOCK_MONOTONIC, &time_point)); + zassume_ok(clock_gettime(CLOCK_REALTIME, &time_point)); timespec_add_ms(&time_point, TIMEDLOCK_TIMEOUT_MS); return INT_TO_POINTER(pthread_mutex_timedlock(mtx, &time_point)); diff --git a/tests/posix/common/src/pthread.c b/tests/posix/common/src/pthread.c index 035730ee4dc73..96a16f7ddb33b 100644 --- a/tests/posix/common/src/pthread.c +++ b/tests/posix/common/src/pthread.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -409,8 +410,8 @@ ZTEST(pthread, test_pthread_timedjoin) }; /* setup timespecs when the thread is still running and when it is done */ - clock_gettime(CLOCK_MONOTONIC, ¬_done); - clock_gettime(CLOCK_MONOTONIC, &done); + clock_gettime(CLOCK_REALTIME, ¬_done); + clock_gettime(CLOCK_REALTIME, &done); not_done.tv_nsec += sleep_duration_ms / 2 * NSEC_PER_MSEC; done.tv_nsec += sleep_duration_ms * 1.5 * NSEC_PER_MSEC; while (not_done.tv_nsec >= NSEC_PER_SEC) {