[gcc(refs/users/aoliva/heads/testme)] libstdc++: vxworks: enable clock_gettime
Alexandre Oliva
aoliva@gcc.gnu.org
Mon May 11 07:07:41 GMT 2026
https://gcc.gnu.org/g:3f8234f083a37724b6514e1afaebbca009e5fb04
commit 3f8234f083a37724b6514e1afaebbca009e5fb04
Author: Alexandre Oliva <oliva@adacore.com>
Date: Mon May 11 03:46:46 2026 -0300
libstdc++: vxworks: enable clock_gettime
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.
Diff:
---
libstdc++-v3/acinclude.m4 | 2 ++
libstdc++-v3/configure | 2 ++
2 files changed, 4 insertions(+)
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 8dc9e17b214c..e7bc4fbf90c7 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -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)
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 6713e4504b1c..3785ad94f330 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -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)
More information about the Libstdc++-cvs
mailing list