[libcxx-commits] [libcxx] [libc++] Sync the filesystem clock_gettime handling with chrono for OpenBSD (PR #92675)
Brad Smith via libcxx-commits
libcxx-commits at lists.llvm.org
Sat May 18 19:09:24 PDT 2024
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/92675
Copy the same OS checks for clock_gettime from chrono to filesystem and
tweak the comment as Hurd is in the same situation.
>From 330921c997390d9421802eb9e162bb06000516c1 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Sat, 18 May 2024 22:05:10 -0400
Subject: [PATCH] [libc++] Sync the filesystem clock_gettime handling with
chrono for OpenBSD
Copy the same OS checks for clock_gettime from chrono to filesystem and
tweak the comment as Hurd is in the same situation.
---
libcxx/src/chrono.cpp | 4 ++--
libcxx/src/filesystem/filesystem_clock.cpp | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp
index e7d6dfbc22924..e8ebb67284bbb 100644
--- a/libcxx/src/chrono.cpp
+++ b/libcxx/src/chrono.cpp
@@ -31,8 +31,8 @@
# include <sys/time.h> // for gettimeofday and timeval
#endif
-// OpenBSD does not have a fully conformant suite of POSIX timers, but
-// it does have clock_gettime and CLOCK_MONOTONIC which is all we need.
+// GNU Hurd and OpenBSD do not implement a fully conformant suite of POSIX timers, but
+// they do have clock_gettime and CLOCK_MONOTONIC which are all we need.
#if defined(__APPLE__) || defined(__gnu_hurd__) || defined(__OpenBSD__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
# define _LIBCPP_HAS_CLOCK_GETTIME
#endif
diff --git a/libcxx/src/filesystem/filesystem_clock.cpp b/libcxx/src/filesystem/filesystem_clock.cpp
index e13b2853e367c..a120be14978a3 100644
--- a/libcxx/src/filesystem/filesystem_clock.cpp
+++ b/libcxx/src/filesystem/filesystem_clock.cpp
@@ -29,7 +29,9 @@
# include <sys/time.h> // for gettimeofday and timeval
#endif
-#if defined(__APPLE__) || defined(__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
+// GNU Hurd and OpenBSD do not implement a fully conformant suite of POSIX timers, but
+// they do have clock_gettime and CLOCK_MONOTONIC which are all we need.
+#if defined(__APPLE__) || defined(__gnu_hurd__) || defined(__OpenBSD__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
# define _LIBCPP_HAS_CLOCK_GETTIME
#endif
More information about the libcxx-commits
mailing list