Fall back on clock_gettime when timespec_get() is unavailable

Fixes: e3a8013de8 "util/u_queue: add util_queue_fence_wait_timeout"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1020
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4088

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Yurii Kolesnykov <root@yurikoles.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8482>
This commit is contained in:
Jeremy Huddleston Sequoia 2021-01-12 16:44:34 -08:00 committed by Marge Bot
parent 81becaa685
commit 68a785e63f
1 changed files with 4 additions and 0 deletions

View File

@ -183,7 +183,11 @@ _util_queue_fence_wait_timeout(struct util_queue_fence *fence,
if (rel > 0) {
struct timespec ts;
#ifdef HAVE_TIMESPEC_GET
timespec_get(&ts, TIME_UTC);
#else
clock_gettime(CLOCK_REALTIME, &ts);
#endif
ts.tv_sec += abs_timeout / (1000*1000*1000);
ts.tv_nsec += abs_timeout % (1000*1000*1000);