On Fri, Nov 01, 2024 at 02:01:18PM -0400, John David Anglin wrote:
> This breaks build on hppa64-hp-hpux11.11.  This target has clock_gettime
> but it doesn't have CLOCK_MONOTONIC.  It has CLOCK_REALTIME.  I modified
> timevar.cc as follows to restore build.

Alternative would be to check for CLOCK_GETTIME in autoconf, but I guess
that will work too.


> Dave
> ---
> 
> diff --git a/gcc/timevar.cc b/gcc/timevar.cc
> index e12775e6ff3..412d9b62a8f 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

Reply via email to