Imported Upstream version 1.64.0
[platform/upstream/boost.git] / boost / thread / detail / thread.hpp
index 9e7e8b8..bd2f149 100644 (file)
@@ -482,13 +482,20 @@ namespace boost
           return try_join_until(chrono::steady_clock::now() + rel_time);
         }
 #endif
+
+#if defined(BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC) && defined(BOOST_THREAD_USEFIXES_TIMESPEC)
+        typedef chrono::steady_clock my_clock_t;
+#else
+        typedef chrono::system_clock my_clock_t;
+#endif
+
         template <class Clock, class Duration>
         bool try_join_until(const chrono::time_point<Clock, Duration>& t)
         {
           using namespace chrono;
           bool joined= false;
           do {
-            system_clock::time_point     s_now = system_clock::now();
+            my_clock_t::time_point     s_now = my_clock_t::now();
             typename Clock::duration   d = ceil<nanoseconds>(t-Clock::now());
             if (d <= Clock::duration::zero()) return false; // in case the Clock::time_point t is already reached
             joined = try_join_until(s_now + d);
@@ -496,10 +503,10 @@ namespace boost
           return true;
         }
         template <class Duration>
-        bool try_join_until(const chrono::time_point<chrono::system_clock, Duration>& t)
+        bool try_join_until(const chrono::time_point<my_clock_t, Duration>& t)
         {
           using namespace chrono;
-          typedef time_point<system_clock, nanoseconds> nano_sys_tmpt;
+          typedef time_point<my_clock_t, nanoseconds> nano_sys_tmpt;
           return try_join_until(nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch())));
         }
 #endif
@@ -514,7 +521,7 @@ namespace boost
         //}
 
 #ifdef BOOST_THREAD_USES_CHRONO
-        bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp)
+        bool try_join_until(const chrono::time_point<my_clock_t, chrono::nanoseconds>& tp)
         {
           chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now());
           return do_try_join_until(rel_time.count());