]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Use CLOCK_MONOTONIC on VxWorks
authorDoug Rupp <rupp@adacore.com>
Thu, 12 Oct 2023 19:31:46 +0000 (12:31 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 Nov 2023 09:57:41 +0000 (10:57 +0100)
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

gcc/ada/s-oscons-tmplt.c

index fb6bb0f043bdfe5a3c41b5a1cd0af0f7f96d41ef..f1140d5ecbcd575952bf4de64541c1c928737df9 100644 (file)
@@ -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).