time: Allow using different clocks

On some systems it might be preferable to use e.g. CLOCK_BOOTTIME
instead of CLOCK_MONOTONIC, which is also not affected by time
adjustments but includes times when the system was suspended.
This commit is contained in:
Tobias Brunner
2020-06-02 13:57:37 +02:00
parent 8b93510dac
commit 3e358475bb
3 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -337,7 +337,7 @@ condvar_t *condvar_create(condvar_type_t type)
pthread_condattr_t condattr;
pthread_condattr_init(&condattr);
#ifdef HAVE_CONDATTR_CLOCK_MONOTONIC
pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC);
pthread_condattr_setclock(&condattr, TIME_CLOCK_ID);
#endif
pthread_cond_init(&this->condvar, &condattr);
pthread_condattr_destroy(&condattr);