Skip to content

Commit 06867d9

Browse files
author
John David Anglin
committed
Fix timevar.cc build on systems that don't have CLOCK_MONOTONIC
2024-12-26 John David Anglin <[email protected]> gcc/ChangeLog: PR target/118050 * timevar.cc (get_time): Only use CLOCK_MONOTONIC if '_POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)'. Otherise, use CLOCK_REALTIME.
1 parent d061c68 commit 06867d9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

gcc/timevar.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ get_time (struct timevar_time_def *now)
160160

161161
#ifdef HAVE_CLOCK_GETTIME
162162
struct timespec ts;
163+
#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
163164
clock_gettime (CLOCK_MONOTONIC, &ts);
165+
#else
166+
clock_gettime (CLOCK_REALTIME, &ts);
167+
#endif
164168
now->wall = ts.tv_sec * 1000000000 + ts.tv_nsec;
165169
return;
166170
#define HAVE_WALL_TIME 1

0 commit comments

Comments
 (0)