summaryrefslogtreecommitdiffstats
path: root/libcxx/test/support/filesystem_test_helper.hpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-06-18 18:32:26 +0000
committerEric Fiselier <eric@efcs.ca>2016-06-18 18:32:26 +0000
commit824ed8c03ee17bf8680a8faac0ba5a2bd8c80dd3 (patch)
treed9492607ca456de061281787ede31fb4ee1317c7 /libcxx/test/support/filesystem_test_helper.hpp
parent03a899957fb099adfd580aaaaf18ae9605932325 (diff)
downloadbcm5719-llvm-824ed8c03ee17bf8680a8faac0ba5a2bd8c80dd3.tar.gz
bcm5719-llvm-824ed8c03ee17bf8680a8faac0ba5a2bd8c80dd3.zip
Fix SleepFor(...) helper when a monotonic clock is not available.
Single threaded builds often don't provide a monotonic clock, so we can't always provide a monotonic SleepFor(...) implementation. Hopefully this won't cause the builds to hang. llvm-svn: 273091
Diffstat (limited to 'libcxx/test/support/filesystem_test_helper.hpp')
-rw-r--r--libcxx/test/support/filesystem_test_helper.hpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libcxx/test/support/filesystem_test_helper.hpp b/libcxx/test/support/filesystem_test_helper.hpp
index fdab4d6153f..7e3c7399a10 100644
--- a/libcxx/test/support/filesystem_test_helper.hpp
+++ b/libcxx/test/support/filesystem_test_helper.hpp
@@ -388,9 +388,13 @@ inline std::error_code GetTestEC() {
// available in single-threaded mode.
void SleepFor(std::chrono::seconds dur) {
using namespace std::chrono;
- const auto curr_time = steady_clock::now();
- auto wake_time = curr_time + dur;
- while (steady_clock::now() < wake_time)
+#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
+ using Clock = system_clock;
+#else
+ using Clock = steady_clock;
+#endif
+ const auto wake_time = Clock::now() + dur;
+ while (Clock::now() < wake_time)
;
}
OpenPOWER on IntegriCloud