BUILD: clock: improve check for pthread_getcpuclockid()

if _POSIX_THREAD_CPUTIME is greater than 0, pthread_getcpuclockid()
is implemented.

This should fix the build on Solaris 11.

Reference: https://docs.oracle.com/cd/E88353_01/html/E37842/unistd-3head.html
ML: https://www.mail-archive.com/haproxy@formilux.org/msg44915.html
This commit is contained in:
Ilia Shipitsin 2024-05-05 13:09:22 +02:00 committed by Willy Tarreau
parent 22ff8aa97c
commit a7cf2454dd

View File

@ -135,7 +135,7 @@ uint64_t now_cpu_time_thread(int thr)
/* set the clock source for the local thread */
void clock_set_local_source(void)
{
#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME)
#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)
#ifdef USE_THREAD
pthread_getcpuclockid(pthread_self(), &per_thread_clock_id[tid]);
#else