Subject: [Boost-bugs] [Boost C++ Libraries] #4727: thread_time.hpp get_system_time depends on BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK being defined
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-10-11 21:28:00
#4727: thread_time.hpp get_system_time depends on
BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK being defined
---------------------------------+------------------------------------------
Reporter: nstewart@⦠| Owner: anthonyw
Type: Patches | Status: new
Milestone: Boost-1.45.0 | Component: thread
Version: Boost 1.44.0 | Severity: Problem
Keywords: |
---------------------------------+------------------------------------------
Came across this issue while cross-compiling for Android.
The implementation of boost::get_system_time depends on
microsec_clock<system_time>, which does not exist unless
BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK is defined.
The attached patch takes a similar approach to:
https://svn.boost.org/trac/boost/changeset/58704
Index: thread_time.hpp
===================================================================
--- thread_time.hpp (revision 65916)
+++ thread_time.hpp (working copy)
@@ -6,6 +6,7 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+#include <boost/date_time/time_clock.hpp>
#include <boost/date_time/microsec_time_clock.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
@@ -17,7 +18,11 @@
inline system_time get_system_time()
{
+#if defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
return
boost::date_time::microsec_clock<system_time>::universal_time();
+#else // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
+ return
boost::date_time::second_clock<system_time>::universal_time();
+#endif // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
}
namespace detail
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4727> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC