perfetto: fix macos compile

On macos, <sys/types.h> does not declare clockid_t,
but it's instead in <time.h>, which also includes
<sys/types.h> on Linux, so just include <time.h> on
all UNIX platforms.

Fixes: a871eabc
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12064
Tested-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31881>
This commit is contained in:
Russell Greene 2024-10-28 21:24:12 -06:00 committed by Marge Bot
parent 276447ef81
commit ae9d365686

View file

@ -25,11 +25,12 @@
#define _UTIL_PERFETTO_H
#include "util/u_atomic.h"
#include "util/detect_os.h"
// On Unix, pass a clockid_t to designate which clock was used to gather the timestamp
// On Windows, this paramter is ignored, and it's expected that `timestamp` comes from QueryPerformanceCounter
#ifndef _WIN32
#include <sys/types.h>
#if DETECT_OS_POSIX
#include <time.h>
typedef clockid_t perfetto_clock_id;
#else
typedef int32_t perfetto_clock_id;