summaryrefslogtreecommitdiff
path: root/boost/thread/pthread/condition_variable_fwd.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/thread/pthread/condition_variable_fwd.hpp')
-rw-r--r--boost/thread/pthread/condition_variable_fwd.hpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/boost/thread/pthread/condition_variable_fwd.hpp b/boost/thread/pthread/condition_variable_fwd.hpp
index 652a8c0baa..802a5cc674 100644
--- a/boost/thread/pthread/condition_variable_fwd.hpp
+++ b/boost/thread/pthread/condition_variable_fwd.hpp
@@ -17,6 +17,7 @@
#if defined BOOST_THREAD_USES_DATETIME
#include <boost/thread/xtime.hpp>
#endif
+
#ifdef BOOST_THREAD_USES_CHRONO
#include <boost/chrono/system_clocks.hpp>
#include <boost/chrono/ceil.hpp>
@@ -68,7 +69,20 @@ namespace boost
unique_lock<mutex>& lock,
struct timespec const &timeout)
{
- return do_wait_until(lock, boost::detail::timespec_plus(timeout, boost::detail::timespec_now()));
+#if ! defined BOOST_THREAD_USEFIXES_TIMESPEC
+ return do_wait_until(lock, boost::detail::timespec_plus(timeout, boost::detail::timespec_now()));
+#elif ! defined BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
+ //using namespace chrono;
+ //nanoseconds ns = chrono::system_clock::now().time_since_epoch();
+
+ struct timespec ts = boost::detail::timespec_now_realtime();
+ //ts.tv_sec = static_cast<long>(chrono::duration_cast<chrono::seconds>(ns).count());
+ //ts.tv_nsec = static_cast<long>((ns - chrono::duration_cast<chrono::seconds>(ns)).count());
+ return do_wait_until(lock, boost::detail::timespec_plus(timeout, ts));
+#else
+ // old behavior was fine for monotonic
+ return do_wait_until(lock, boost::detail::timespec_plus(timeout, boost::detail::timespec_now_realtime()));
+#endif
}
public: