File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 6
6
7
7
#include <errno.h>
8
8
#include <pthread.h>
9
+ #include <time.h>
9
10
10
11
#include <zephyr/sys/util.h>
11
12
#include <zephyr/ztest.h>
@@ -182,7 +183,7 @@ static void *test_mutex_timedlock_fn(void *arg)
182
183
struct timespec time_point ;
183
184
pthread_mutex_t * mtx = (pthread_mutex_t * )arg ;
184
185
185
- zassume_ok (clock_gettime (CLOCK_MONOTONIC , & time_point ));
186
+ zassume_ok (clock_gettime (CLOCK_REALTIME , & time_point ));
186
187
timespec_add_ms (& time_point , TIMEDLOCK_TIMEOUT_MS );
187
188
188
189
return INT_TO_POINTER (pthread_mutex_timedlock (mtx , & time_point ));
Original file line number Diff line number Diff line change 6
6
7
7
#include <pthread.h>
8
8
#include <semaphore.h>
9
+ #include <time.h>
9
10
10
11
#include <zephyr/sys/util.h>
11
12
#include <zephyr/ztest.h>
@@ -409,8 +410,8 @@ ZTEST(pthread, test_pthread_timedjoin)
409
410
};
410
411
411
412
/* setup timespecs when the thread is still running and when it is done */
412
- clock_gettime (CLOCK_MONOTONIC , & not_done );
413
- clock_gettime (CLOCK_MONOTONIC , & done );
413
+ clock_gettime (CLOCK_REALTIME , & not_done );
414
+ clock_gettime (CLOCK_REALTIME , & done );
414
415
not_done .tv_nsec += sleep_duration_ms / 2 * NSEC_PER_MSEC ;
415
416
done .tv_nsec += sleep_duration_ms * 1.5 * NSEC_PER_MSEC ;
416
417
while (not_done .tv_nsec >= NSEC_PER_SEC ) {
You can’t perform that action at this time.
0 commit comments