]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: vxworks: enable clock_gettime
authorAlexandre Oliva <oliva@adacore.com>
Mon, 11 May 2026 06:46:46 +0000 (03:46 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Tue, 12 May 2026 07:31:45 +0000 (04:31 -0300)
We've been using gettimeofday() on VxWorks, because configury didn't
state clock_gettime was available.  It has been since at least
vxworks6.9, possibly earlier.  Indeed, it's been available for longer
than gettimeofday(), so this enables libstdc++'s chrono.cc to work
with earlier 6.9 releases.

We've used clock_gettime unconditionally in __gthread_cond_timedwait
for a very long time, so it's not like this brings in a new
dependency, but it allows clocks and deadlines to work with the same
precision.  Before this change, we'd use gettimeofday's coarser
clocks, and finer timed waits, which makes room for imprecisions.

for  libstdc++-v3/ChangeLog

* acinclude.m4 (GLIBXX_ENABLE_LIBSTDCXX_TIME) [vxworks*]:
Enable monotonic and realtime clocks.
* configure: Rebuilt.

libstdc++-v3/acinclude.m4
libstdc++-v3/configure

index 8dc9e17b214cd30087673c6f4c0707cab3adecc3..e7bc4fbf90c773c488b98fa4285aa6273c7fbcd5 100644 (file)
@@ -1785,6 +1785,8 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
       # VxWorks has nanosleep as soon as the kernel is configured with
       # INCLUDE_POSIX_TIMERS, which is normally/most-often the case.
       vxworks*)
+        ac_has_clock_monotonic=yes
+        ac_has_clock_realtime=yes
         ac_has_nanosleep=yes
         ;;
       gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
index 6713e4504b1cd5ac2c7eddea758f8a51ab3d946e..3785ad94f3302e3f0f44fe9a3d240982139f7dfe 100755 (executable)
@@ -21473,6 +21473,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
       # VxWorks has nanosleep as soon as the kernel is configured with
       # INCLUDE_POSIX_TIMERS, which is normally/most-often the case.
       vxworks*)
+        ac_has_clock_monotonic=yes
+        ac_has_clock_realtime=yes
         ac_has_nanosleep=yes
         ;;
       gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)