Boost C++ Libraries: Ticket #4727: thread_time.hpp get_system_time depends on BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK being defined https://svn.boost.org/trac10/ticket/4727 <p> Came across this issue while cross-compiling for Android. </p> <p> The implementation of boost::get_system_time depends on microsec_clock&lt;system_time&gt;, which does not exist unless BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK is defined. </p> <p> The attached patch takes a similar approach to: <a class="ext-link" href="https://svn.boost.org/trac/boost/changeset/58704"><span class="icon">​</span>https://svn.boost.org/trac/boost/changeset/58704</a> </p> <p> Index: thread_time.hpp =================================================================== --- thread_time.hpp (revision 65916) +++ thread_time.hpp (working copy) @@ -6,6 +6,7 @@ </p> <blockquote> <p> <em> accompanying file LICENSE_1_0.txt or copy at </em> <a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </blockquote> <p> +#include &lt;boost/date_time/time_clock.hpp&gt; </p> <blockquote> <p> #include &lt;boost/date_time/microsec_time_clock.hpp&gt; #include &lt;boost/date_time/posix_time/posix_time_types.hpp&gt; </p> </blockquote> <p> @@ -17,7 +18,11 @@ </p> <blockquote> <p> inline system_time get_system_time() { </p> </blockquote> <p> +#if defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) </p> <blockquote> <p> return boost::date_time::microsec_clock&lt;system_time&gt;::universal_time(); </p> </blockquote> <p> +#else <em> defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) + return boost::date_time::second_clock&lt;system_time&gt;::universal_time(); +#endif </em> defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) </p> <blockquote> <p> } </p> </blockquote> <p> </p> <blockquote> <p> namespace detail </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4727 Trac 1.4.3 nstewart@… Mon, 11 Oct 2010 21:28:48 GMT attachment set https://svn.boost.org/trac10/ticket/4727 https://svn.boost.org/trac10/ticket/4727 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_thread_time.patch</span> </li> </ul> <p> Diff w.r.t 65916 (Oct 11th 2010) </p> Ticket Anthony Williams Fri, 22 Oct 2010 09:35:57 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4727#comment:1 https://svn.boost.org/trac10/ticket/4727#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed on trunk, revision 66141 </p> Ticket