diff options
author | John David Anglin <danglin@gcc.gnu.org> | 2024-12-26 11:27:36 -0500 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2024-12-26 11:27:36 -0500 |
commit | 06867d9fa69ca6d4ded4602e6601c7153599cbff (patch) | |
tree | 6ac355cbc5dc7d411efb8131fd2ee0126b9c1996 | |
parent | d061c681814917c2208f383bd6069e6ab90db220 (diff) | |
download | gcc-06867d9fa69ca6d4ded4602e6601c7153599cbff.zip gcc-06867d9fa69ca6d4ded4602e6601c7153599cbff.tar.gz gcc-06867d9fa69ca6d4ded4602e6601c7153599cbff.tar.bz2 |
Fix timevar.cc build on systems that don't have CLOCK_MONOTONIC
2024-12-26 John David Anglin <danglin@gcc.gnu.org>
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.
-rw-r--r-- | gcc/timevar.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/timevar.cc b/gcc/timevar.cc index 48d0c72..21fd65d 100644 --- a/gcc/timevar.cc +++ b/gcc/timevar.cc @@ -160,7 +160,11 @@ get_time (struct timevar_time_def *now) #ifdef HAVE_CLOCK_GETTIME struct timespec ts; +#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK) clock_gettime (CLOCK_MONOTONIC, &ts); +#else + clock_gettime (CLOCK_REALTIME, &ts); +#endif now->wall = ts.tv_sec * 1000000000 + ts.tv_nsec; return; #define HAVE_WALL_TIME 1 |