From: Doug Rupp Date: Thu, 12 Oct 2023 19:31:46 +0000 (-0700) Subject: ada: Use CLOCK_MONOTONIC on VxWorks X-Git-Tag: basepoints/gcc-15~4488 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fee97b366b10acbbc0aa5300c2ad753c18d2b266;p=thirdparty%2Fgcc.git ada: Use CLOCK_MONOTONIC on VxWorks The monotonic clock keeps track of the time that has elapsed since system startup; that is, the value returned by clock_gettime() is the amount of time (in seconds and nanoseconds) that has passed since the system booted. The monotonic clock cannot be reset. As a result, time interval measurements made relative to the monotonic clock are not subject to errors resulting from the clock time being unexpectedly adjusted between the interval start and end. gcc/ada/ * s-oscons-tmplt.c: #define CLOCK_RT_Ada "CLOCK_MONOTONIC" for __vxworks --- diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index fb6bb0f043bd..f1140d5ecbcd 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -1975,7 +1975,8 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock") #if defined(__linux__) || defined(__FreeBSD__) \ || (defined(_AIX) && defined(_AIXVERSION_530)) \ - || defined(__DragonFly__) || defined(__QNX__) + || defined(__DragonFly__) || defined(__QNX__) \ + || defined (__vxworks) /** On these platforms use system provided monotonic clock instead of ** the default CLOCK_REALTIME. We then need to set up cond var attributes ** appropriately (see thread.c).