Boost C++ Libraries: Ticket #9379: 'boost::chrono::steady_clock' has not been declared" on boost 1.55, hp-ux 11.23 IA, gcc 4.6 https://svn.boost.org/trac10/ticket/9379 <pre class="wiki">../lib/include/boost/boost/thread/pthread/recursive_mutex.hpp: In member function 'bool boost::recursive_timed_mutex::try_lock_for(const boost::chrono::duration&lt;Rep, Period&gt;&amp;)': ../lib/include/boost/boost/thread/pthread/recursive_mutex.hpp:357:41: error: 'boost::chrono::steady_clock' has not been declared In file included from ../lib/include/boost/boost/thread.hpp:24:0, from ../src/ ... ../lib/include/boost/boost/thread/future.hpp: In member function 'boost::future_status boost::detail::basic_future&lt;R&gt;::wait_for(const boost::chrono::duration&lt;Rep2, Period2&gt;&amp;) const': ../lib/include/boost/boost/thread/future.hpp:1395:37: error: 'boost:: </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9379 Trac 1.4.3 anonymous Wed, 13 Nov 2013 03:51:26 GMT <link>https://svn.boost.org/trac10/ticket/9379#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:1</guid> <description> <p> ./lib/include/boost/boost/thread/pthread/condition_variable.hpp: In member function 'boost::cv_status boost::condition_variable_any::wait_for(lock_type&amp;, const boost::chrono::duration&lt;Rep2, Period&gt;&amp;)': ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:295:11: error: 'steady_clock' has not been declared ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:295:36: error: expected ';' before 'c_now' ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:297:18: error: 'steady_clock' has not been declared ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:297:40: error: 'c_now' was not declared in this scope ../lib/include/boost/boost/thread/pthread/condition_variable.hpp: In member function 'bool boost::condition_variable_any::wait_for(lock_type&amp;, const boost::chrono::duration&lt;Rep, Period&gt;&amp;, Predicate)': ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:310:43: error: 'boost::chrono::steady_clock' has not been declared In file included from ../lib/include/boost/boost/thread/thread_only.hpp:26:0, </p> <blockquote> <p> from ../lib/include/boost/boost/thread/thread.hpp:12, from ../lib/include/boost/boost/thread.hpp:13, from ../src/... </p> </blockquote> <p> ../lib/include/boost/boost/thread/v2/thread.hpp: At global scope: ../lib/include/boost/boost/thread/v2/thread.hpp:59:47: error: 'steady_clock' is not a member of 'boost::chrono' ../lib/include/boost/boost/thread/v2/thread.hpp:59:47: error: 'steady_clock' is not a member of 'boost::chrono' ../lib/include/boost/boost/thread/v2/thread.hpp:59:77: error: template argument 1 is invalid ../lib/include/boost/boost/thread/v2/thread.hpp: In function 'void boost::this_thread::sleep_until(const int&amp;)': ../lib/include/boost/boost/thread/v2/thread.hpp:62:21: error: 'steady_clock' has not been declared In file included from ../lib/include/boost/boost/thread/shared_mutex.hpp:22:0, </p> <blockquote> <p> from ../lib/include/boost/boost/thread/detail/thread_group.hpp:9, from ../lib/include/boost/boost/thread/thread.hpp:13, from ../lib/include/boost/boost/thread.hpp:13, from ../src/... </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 13 Nov 2013 04:05:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:2</guid> <description> <p> Hi experts, The problem can be reproduced easily, </p> <pre class="wiki">uname -a HP-UX B.11.23 U ia64 $gcc -v gcc version 4.6.3 (GCC) </pre><p> </p> <p> $cat thread.cpp </p> <p> &lt; </p> <pre class="wiki">#include &lt;string&gt; #include &lt;iostream&gt; #include &lt;boost/thread.hpp&gt; using namespace std; class BankAccount; BankAccount JoesAccount; void bankAgent() { for (int i =10; i&gt;0; --i) { //... JoesAccount.Deposit(500); //... } } void Joe() { for (int i =10; i&gt;0; --i) { //... int myPocket = JoesAccount.Withdraw(100); std::cout &lt;&lt; myPocket &lt;&lt; std::endl; //... } } int main() { //... boost::thread thread1(bankAgent); // start concurrent execution of bankAgent boost::thread thread2(Joe); // start concurrent execution of Joe thread1.join(); thread2.join(); return 0; } </pre><blockquote class="citation"> </blockquote> <pre class="wiki">Error: &lt; irvspxue:builder&gt; g++ -Iboost_1_55_0 -o thread thread.cpp In file included from boost_1_55_0/boost/thread/mutex.hpp:16:0, from boost_1_55_0/boost/thread/pthread/thread_data.hpp:13, from boost_1_55_0/boost/thread/thread_only.hpp:17, from boost_1_55_0/boost/thread/thread.hpp:12, from boost_1_55_0/boost/thread.hpp:13, from thread.cpp:5: boost_1_55_0/boost/thread/pthread/mutex.hpp: In member function 'bool boost::timed_mutex::try_lock_for(const boost::chrono::duration&lt;Rep, Period&gt;&amp;)': boost_1_55_0/boost/thread/pthread/mutex.hpp:309:41: error: 'boost::chrono::steady_clock' has not been declared In file included from boost_1_55_0/boost/thread/pthread/thread_data.hpp:14:0, from boost_1_55_0/boost/thread/thread_only.hpp:17, from boost_1_55_0/boost/thread/thread.hpp:12, from boost_1_55_0/boost/thread.hpp:13, from thread.cpp:5: boost_1_55_0/boost/thread/pthread/condition_variable_fwd.hpp: In member function 'boost::cv_status boost::condition_variable::wait_for(boost::unique_lock&lt;boost::mutex&gt;&amp;, const boost::chrono::duration&lt;Rep, Period&gt;&amp;)': &gt; </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 16 Nov 2013 20:45:33 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/9379#comment:3 https://svn.boost.org/trac10/ticket/9379#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket viboes Sat, 16 Nov 2013 20:48:58 GMT <link>https://svn.boost.org/trac10/ticket/9379#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:4</guid> <description> <p> HI, </p> <p> please could you check the boost/chrono/config.hpp file. </p> <p> It contains the following </p> <pre class="wiki"># if defined( BOOST_CHRONO_WINDOWS_API ) # ifndef UNDER_CE # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # endif # define BOOST_CHRONO_HAS_CLOCK_STEADY # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined( BOOST_CHRONO_MAC_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # define BOOST_CHRONO_HAS_CLOCK_STEADY # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # include &lt;time.h&gt; //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY # endif </pre><p> Does your platform meets the condition for which BOOST_CHRONO_HAS_CLOCK_STEADY is defined? </p> </description> <category>Ticket</category> </item> <item> <author>gengyonghui@…</author> <pubDate>Sun, 17 Nov 2013 11:13:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:5</guid> <description> <p> I tested the micro, it is NOT defined under hp-ux ia 11.23, hp-ux pa 11.11, and solaris 8/9. But is defined under AIX 5.2. </p> <p> $uname -a HP-UX machinename B.11.23 U ia64 unlimited-user license </p> <p> $cat micro.cpp #include &lt;string&gt; #include &lt;iostream&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;boost/chrono/config.hpp&gt; using namespace std; </p> <p> int main() { #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY </p> <blockquote> <p> printf("boost_chrono_has_clock_steady is defined!\n"); </p> </blockquote> <p> #else </p> <blockquote> <p> printf("boost_chrono_has_clock_steady is not defined!\n"); </p> </blockquote> <p> #endif </p> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> $g++ -Iboost_1_55_0 -o micro micro.cpp </p> <p> $./micro boost_chrono_has_clock_steady is not defined! </p> <p> Thanks. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 17 Nov 2013 11:37:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:6</guid> <description> <p> I was requesting you to analyze why it is not defined. It is because CLOCK_MONOTONIC is not defined? If yes, could you find if there is something like that? </p> </description> <category>Ticket</category> </item> <item> <author>gengyonghui@…</author> <pubDate>Mon, 18 Nov 2013 16:03:01 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/9379 https://svn.boost.org/trac10/ticket/9379 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">user_time.h</span> </li> </ul> Ticket gengyonghui@… Mon, 18 Nov 2013 16:03:18 GMT attachment set https://svn.boost.org/trac10/ticket/9379 https://svn.boost.org/trac10/ticket/9379 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">user_sys_time.h</span> </li> </ul> Ticket anonymous Mon, 18 Nov 2013 16:05:52 GMT <link>https://svn.boost.org/trac10/ticket/9379#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:7</guid> <description> <p> Hi Viboes, You are right, CLOCK_MONOTONIC is not defined. I have attached /usr/include/time.h and /usr/include/sys/time.h files. Thanks. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 23 Nov 2013 18:09:05 GMT</pubDate> <title>description changed https://svn.boost.org/trac10/ticket/9379#comment:8 https://svn.boost.org/trac10/ticket/9379#comment:8 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/9379?action=diff&amp;version=8">diff</a>) </li> </ul> Ticket viboes Tue, 03 Dec 2013 22:48:55 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/9379#comment:9 https://svn.boost.org/trac10/ticket/9379#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> Ticket brian.groose@… Fri, 20 Jun 2014 19:47:26 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/9379#comment:10 https://svn.boost.org/trac10/ticket/9379#comment:10 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">worksforme</span> </li> </ul> <p> I have the same issue on HP/UX. CLOCK_MONOTONIC is not available on HP/UX. I suppose CLOCK_REALTIME would be a non-optimal fallback. However, there is a gethrtime() function that returns a similar value to clock_gettime(CLOCK_MONOTONIC), also measured in nanoseconds: </p> <p> typedef int64_t hrtime_t; </p> <p> hrtime_t gethrtime(void); </p> Ticket viboes Tue, 08 Jul 2014 19:30:41 GMT <link>https://svn.boost.org/trac10/ticket/9379#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:11</guid> <description> <p> Please, could you provide a patch, I'm unable to test it, so unable to write it. </p> </description> <category>Ticket</category> </item> <item> <author>20313412@…</author> <pubDate>Sun, 25 Jan 2015 06:44:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:12</guid> <description> <p> Hi Viboes,I have the same issue too. Could you please provide a patch? Or any suggestion/workaround to resolve this issue? I'll follow your suggestion to write a patch and verify the patch in our environment as soon as possible . </p> </description> <category>Ticket</category> </item> <item> <author>20313412@…</author> <pubDate>Sun, 25 Jan 2015 06:48:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:13</guid> <description> <p> My email address 20313412@…, anyone knows how to fix this issue please mail me. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 25 Jan 2015 07:54:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:14</guid> <description> <p> Ok. I will create a branch to take care of this issue. I will add code as soon as I know what to put in. I would need that you check this branch on your environment. </p> <p> We can start by identifying under which conditions gethrtime is available. Try something like that and tell me what to put in WHATEVER_HPUX_SPECIFIC_FLAG_ENSURES_GETHRTIME_WILL_BE_DEFINED. </p> <pre class="wiki">git diff diff --git a/include/boost/chrono/config.hpp b/include/boost/chrono/config.hpp index 1045ba3..7ae6d8f 100644 --- a/include/boost/chrono/config.hpp +++ b/include/boost/chrono/config.hpp @@ -84,6 +84,13 @@ # include &lt;time.h&gt; //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY +# if BOOST_PLATFORM="HP-UX" +# include &lt;user_time.h&gt; //to check for gethrtime +# if defined(WHATEVER_HPUX_SPECIFIC_FLAG_ENSURES_GETHRTIME_WILL_BE_DEFINED) +# define BOOST_CHRONO_HAS_GETHRTIME +# define BOOST_CHRONO_HAS_CLOCK_STEADY +# endif +# endif # endif </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 25 Jan 2015 08:10:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:15 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:15</guid> <description> <p> Once you have found the flag, we can continue with </p> <pre class="wiki">diff --git a/include/boost/chrono/detail/inlined/posix/chrono.hpp b/include/boost/chrono/detail/inlined/posix/chrono.hpp index e35a7ce..5a0d42d 100644 --- a/include/boost/chrono/detail/inlined/posix/chrono.hpp +++ b/include/boost/chrono/detail/inlined/posix/chrono.hpp @@ -73,6 +73,9 @@ namespace chrono steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT { +#ifdef BOOST_CHRONO_HAS_GETHRTIME + return time_point(nanoseconds(gethrtime()); +#else timespec ts; if ( ::clock_gettime( CLOCK_MONOTONIC, &amp;ts ) ) { @@ -81,20 +84,25 @@ namespace chrono return time_point(duration( static_cast&lt;steady_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); +#endif } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING steady_clock::time_point steady_clock::now(system::error_code &amp; ec) { +#ifdef BOOST_CHRONO_HAS_GETHRTIME + ec.clear(); + return time_point(nanoseconds(gethrtime()); +#else timespec ts; if ( ::clock_gettime( CLOCK_MONOTONIC, &amp;ts ) ) { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" )); } else @@ -104,12 +112,13 @@ namespace chrono } } - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point(duration( static_cast&lt;steady_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); +#endif } #endif #endif </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 25 Jan 2015 08:14:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:16 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:16</guid> <description> <p> All this is now in <a class="ext-link" href="https://github.com/boostorg/chrono/tree/fix/hpux_gethrtime"><span class="icon">​</span>https://github.com/boostorg/chrono/tree/fix/hpux_gethrtime</a> </p> <p> The whole patch is <a class="ext-link" href="https://github.com/boostorg/chrono/commit/c7d91e86f39b999ce6c527ef569b682e2e3d3268"><span class="icon">​</span>https://github.com/boostorg/chrono/commit/c7d91e86f39b999ce6c527ef569b682e2e3d3268</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 25 Jan 2015 08:22:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:17 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:17</guid> <description> <p> Maybe this will help you to find out the flag </p> <pre class="wiki">This API will only be available if the application is being compiled in -Ae mode (extended ANSI) because 64-bit integer numbers are not available in -Aa (ANSI) mode. Please refer to cc(1). </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 25 Jan 2015 08:53:26 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:18 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:18</guid> <description> <p> Yet an additional commit </p> <p> Added the possibility for the user to define BOOST_CHRONO_HAS_GETHRTIME and manage with error cases </p> <p> <a class="ext-link" href="https://github.com/boostorg/chrono/commit/b06da09faaa0ee55e991695e81b7320bdaf4e6e6"><span class="icon">​</span>https://github.com/boostorg/chrono/commit/b06da09faaa0ee55e991695e81b7320bdaf4e6e6</a> </p> <p> Please, define BOOST_CHRONO_HAS_GETHRTIME on your build system to see if the patch works. </p> <p> If this is the case, the last thing to find are the flag for WHATEVER_HPUX_SPECIFIC_FLAG_ENSURES_GETHRTIME_WILL_BE_DEFINED. </p> </description> <category>Ticket</category> </item> <item> <author>20313412@…</author> <pubDate>Sun, 25 Jan 2015 14:10:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:19 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:19</guid> <description> <p> Hi Viboes, what a quick response! </p> <p> My test environment: HP-UX B.11.23 ia64, gcc 4.7.1, boost 1.53 and boost 1.57 </p> <p> my findings: </p> <ol><li>there's no header file named user_time.h on hp-ux </li><li>I didn't find any flag(in time.h) which controls the availability of function gethrtime, just use this function directly and everything works fine( or please kindly tell me how to find the Flag that you want); </li><li>with some modification based on your patch, the bug is verified to be fixed!!!! </li><li>please kindly let me know if you want any operation/verification under HP-UX, I'd like to do that. </li></ol><pre class="wiki">--------------------config.hpp------------------------------ #ifndef BOOST_CHRONO_CONFIG_HPP #define BOOST_CHRONO_CONFIG_HPP #include &lt;boost/config.hpp&gt; #if !defined BOOST_CHRONO_VERSION #define BOOST_CHRONO_VERSION 1 #else #if BOOST_CHRONO_VERSION!=1 &amp;&amp; BOOST_CHRONO_VERSION!=2 #error "BOOST_CHRONO_VERSION must be 1 or 2" #endif #endif #if defined(BOOST_CHRONO_SOURCE) &amp;&amp; !defined(BOOST_USE_WINDOWS_H) #define BOOST_USE_WINDOWS_H #endif #if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \ &amp;&amp; ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT # define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT #endif // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API // can be defined by the user to specify which API should be used #if defined(BOOST_CHRONO_WINDOWS_API) # warning Boost.Chrono will use the Windows API #elif defined(BOOST_CHRONO_MAC_API) # warning Boost.Chrono will use the Mac API #elif defined(BOOST_CHRONO_POSIX_API) # warning Boost.Chrono will use the POSIX API #endif # if defined( BOOST_CHRONO_WINDOWS_API ) &amp;&amp; defined( BOOST_CHRONO_POSIX_API ) # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined # elif defined( BOOST_CHRONO_WINDOWS_API ) &amp;&amp; defined( BOOST_CHRONO_MAC_API ) # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined # elif defined( BOOST_CHRONO_MAC_API ) &amp;&amp; defined( BOOST_CHRONO_POSIX_API ) # error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined # elif !defined( BOOST_CHRONO_WINDOWS_API ) &amp;&amp; !defined( BOOST_CHRONO_MAC_API ) &amp;&amp; !defined( BOOST_CHRONO_POSIX_API ) # if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) # define BOOST_CHRONO_WINDOWS_API # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) # define BOOST_CHRONO_MAC_API # else # define BOOST_CHRONO_POSIX_API # endif # endif # if defined( BOOST_CHRONO_WINDOWS_API ) # ifndef UNDER_CE # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # endif # define BOOST_CHRONO_HAS_CLOCK_STEADY # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined( BOOST_CHRONO_MAC_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # define BOOST_CHRONO_HAS_CLOCK_STEADY # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # include &lt;time.h&gt; //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY # elif (defined(__HP_aCC) || defined(__GNUC__)) &amp;&amp; defined(__hpux) # if ! defined BOOST_CHRONO_HAS_GETHRTIME # define BOOST_CHRONO_HAS_GETHRTIME # define BOOST_CHRONO_HAS_CLOCK_STEADY # endif # endif # if defined(_POSIX_THREAD_CPUTIME) &amp;&amp; !defined(BOOST_DISABLE_THREADS) # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined(CLOCK_THREAD_CPUTIME_ID) &amp;&amp; !defined(BOOST_DISABLE_THREADS) # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined(sun) || defined(__sun) # undef BOOST_CHRONO_HAS_THREAD_CLOCK # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY # endif # if (defined(__HP_aCC) || defined(__GNUC__)) &amp;&amp; defined(__hpux) # undef BOOST_CHRONO_HAS_THREAD_CLOCK # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY # endif # if defined(__VXWORKS__) # undef BOOST_CHRONO_HAS_PROCESS_CLOCKS # endif # endif #if defined(BOOST_CHRONO_THREAD_DISABLED) &amp;&amp; defined(BOOST_CHRONO_HAS_THREAD_CLOCK) #undef BOOST_CHRONO_HAS_THREAD_CLOCK #undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY #endif //#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS // unicode support ------------------------------// #if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T) //~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT #else #define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1 #endif #if ! defined BOOST_NOEXCEPT #if defined(BOOST_NO_CXX11_NOEXCEPT) #define BOOST_NOEXCEPT #else #define BOOST_NOEXCEPT noexcept #endif #endif #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) #define BOOST_CHRONO_LIB_CONSTEXPR #else #define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR #endif #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() #else #ifdef BOOST_NO_CXX11_NOEXCEPT # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() #else # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept #endif #endif #if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ &amp;&amp; defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING #error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING &amp;&amp; BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined" #endif #if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ &amp;&amp; defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 #error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 &amp;&amp; BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined" #endif #if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ &amp;&amp; ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING #define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING #endif #if (BOOST_CHRONO_VERSION == 2) #if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ &amp;&amp; ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 #define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 #endif #endif #ifdef BOOST_CHRONO_HEADER_ONLY #define BOOST_CHRONO_INLINE inline #define BOOST_CHRONO_STATIC inline #define BOOST_CHRONO_DECL #else #define BOOST_CHRONO_INLINE #define BOOST_CHRONO_STATIC static // enable dynamic linking on Windows ---------------------------------------// // we need to import/export our code only if the user has specifically // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost // libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK // if they want just this one to be dynamically liked: #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) // export if this is our own source, otherwise import: #ifdef BOOST_CHRONO_SOURCE # define BOOST_CHRONO_DECL BOOST_SYMBOL_EXPORT #else # define BOOST_CHRONO_DECL BOOST_SYMBOL_IMPORT #endif // BOOST_CHRONO_SOURCE #endif // DYN_LINK // // if BOOST_CHRONO_DECL isn't defined yet define it now: #ifndef BOOST_CHRONO_DECL #define BOOST_CHRONO_DECL #endif // enable automatic library variant selection ------------------------------// #if !defined(BOOST_CHRONO_SOURCE) &amp;&amp; !defined(BOOST_ALL_NO_LIB) &amp;&amp; !defined(BOOST_CHRONO_NO_LIB) // // Set the name of our library; this will get undef'ed by auto_link.hpp // once it's done with it: // #define BOOST_LIB_NAME boost_chrono // // If we're importing code from a dll, then tell auto_link.hpp about it: // #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) # define BOOST_DYN_LINK #endif // // And include the header that does the work: // #include &lt;boost/config/auto_link.hpp&gt; #endif // auto-linking disabled #endif // BOOST_CHRONO_HEADER_ONLY #endif // BOOST_CHRONO_CONFIG_HPP </pre><hr /> <pre class="wiki">#include &lt;time.h&gt; // for clock_gettime namespace boost { namespace chrono { system_clock::time_point system_clock::now() BOOST_NOEXCEPT { timespec ts; if ( ::clock_gettime( CLOCK_REALTIME, &amp;ts ) ) { BOOST_ASSERT(0 &amp;&amp; "Boost::Chrono - Internal Error"); } return time_point(duration( static_cast&lt;system_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING system_clock::time_point system_clock::now(system::error_code &amp; ec) { timespec ts; if ( ::clock_gettime( CLOCK_REALTIME, &amp;ts ) ) { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( system::system_error( errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::system_clock" )); } else { ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); return time_point(); } } if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point(duration( static_cast&lt;system_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); } #endif std::time_t system_clock::to_time_t(const system_clock::time_point&amp; t) BOOST_NOEXCEPT { return static_cast&lt;std::time_t&gt;( t.time_since_epoch().count() / 1000000000 ); } system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT { return time_point(duration(static_cast&lt;system_clock::rep&gt;(t) * 1000000000)); } #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT { #ifdef BOOST_CHRONO_HAS_GETHRTIME hrtime_t hrt = gethrtime(); BOOST_ASSERT(hrt&gt;=0); return time_point(nanoseconds(hrt)); #else timespec ts; if ( ::clock_gettime( CLOCK_MONOTONIC, &amp;ts ) ) { BOOST_ASSERT(0 &amp;&amp; "Boost::Chrono - Internal Error"); } return time_point(duration( static_cast&lt;steady_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); #endif } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING steady_clock::time_point steady_clock::now(system::error_code &amp; ec) { #ifdef BOOST_CHRONO_HAS_GETHRTIME hrtime_t hrt = gethrtime(); if (hrt&lt;0) { boost::throw_exception( system::system_error( EFAULT, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" )); } else { ec.assign( EFAULT, BOOST_CHRONO_SYSTEM_CATEGORY ); return time_point(); } if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point(nanoseconds(hrt)); #else timespec ts; if ( ::clock_gettime( CLOCK_MONOTONIC, &amp;ts ) ) { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( system::system_error( errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" )); } else { ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); return time_point(); } } if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point(duration( static_cast&lt;steady_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); #endif } #endif #endif } // namespace chrono } // namespace boost </pre> </description> <category>Ticket</category> </item> <item> <author>20313412@…</author> <pubDate>Sun, 25 Jan 2015 14:18:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:20 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:20</guid> <description> <p> following code for config.hpp works fine! </p> <pre class="wiki"> #ifndef BOOST_CHRONO_CONFIG_HPP #define BOOST_CHRONO_CONFIG_HPP #include &lt;boost/config.hpp&gt; #if !defined BOOST_CHRONO_VERSION #define BOOST_CHRONO_VERSION 1 #else #if BOOST_CHRONO_VERSION!=1 &amp;&amp; BOOST_CHRONO_VERSION!=2 #error "BOOST_CHRONO_VERSION must be 1 or 2" #endif #endif #if defined(BOOST_CHRONO_SOURCE) &amp;&amp; !defined(BOOST_USE_WINDOWS_H) #define BOOST_USE_WINDOWS_H #endif #if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \ &amp;&amp; ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT # define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT #endif // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API // can be defined by the user to specify which API should be used #if defined(BOOST_CHRONO_WINDOWS_API) # warning Boost.Chrono will use the Windows API #elif defined(BOOST_CHRONO_MAC_API) # warning Boost.Chrono will use the Mac API #elif defined(BOOST_CHRONO_POSIX_API) # warning Boost.Chrono will use the POSIX API #endif # if defined( BOOST_CHRONO_WINDOWS_API ) &amp;&amp; defined( BOOST_CHRONO_POSIX_API ) # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined # elif defined( BOOST_CHRONO_WINDOWS_API ) &amp;&amp; defined( BOOST_CHRONO_MAC_API ) # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined # elif defined( BOOST_CHRONO_MAC_API ) &amp;&amp; defined( BOOST_CHRONO_POSIX_API ) # error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined # elif !defined( BOOST_CHRONO_WINDOWS_API ) &amp;&amp; !defined( BOOST_CHRONO_MAC_API ) &amp;&amp; !defined( BOOST_CHRONO_POSIX_API ) # if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) # define BOOST_CHRONO_WINDOWS_API # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) # define BOOST_CHRONO_MAC_API # else # define BOOST_CHRONO_POSIX_API # endif # endif # if defined( BOOST_CHRONO_WINDOWS_API ) # ifndef UNDER_CE # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # endif # define BOOST_CHRONO_HAS_CLOCK_STEADY # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined( BOOST_CHRONO_MAC_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # define BOOST_CHRONO_HAS_CLOCK_STEADY # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # include &lt;time.h&gt; //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY # elif (defined(__HP_aCC) || defined(__GNUC__)) &amp;&amp; defined(__hpux) # if ! defined BOOST_CHRONO_HAS_GETHRTIME # define BOOST_CHRONO_HAS_GETHRTIME # define BOOST_CHRONO_HAS_CLOCK_STEADY # endif # endif # if defined(_POSIX_THREAD_CPUTIME) &amp;&amp; !defined(BOOST_DISABLE_THREADS) # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined(CLOCK_THREAD_CPUTIME_ID) &amp;&amp; !defined(BOOST_DISABLE_THREADS) # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true # endif # if defined(sun) || defined(__sun) # undef BOOST_CHRONO_HAS_THREAD_CLOCK # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY # endif # if (defined(__HP_aCC) || defined(__GNUC__)) &amp;&amp; defined(__hpux) # undef BOOST_CHRONO_HAS_THREAD_CLOCK # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY # endif # if defined(__VXWORKS__) # undef BOOST_CHRONO_HAS_PROCESS_CLOCKS # endif # endif #if defined(BOOST_CHRONO_THREAD_DISABLED) &amp;&amp; defined(BOOST_CHRONO_HAS_THREAD_CLOCK) #undef BOOST_CHRONO_HAS_THREAD_CLOCK #undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY #endif //#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS // unicode support ------------------------------// #if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T) //~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT #else #define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1 #endif #if ! defined BOOST_NOEXCEPT #if defined(BOOST_NO_CXX11_NOEXCEPT) #define BOOST_NOEXCEPT #else #define BOOST_NOEXCEPT noexcept #endif #endif #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) #define BOOST_CHRONO_LIB_CONSTEXPR #else #define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR #endif #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() #else #ifdef BOOST_NO_CXX11_NOEXCEPT # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() #else # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept #endif #endif #if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ &amp;&amp; defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING #error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING &amp;&amp; BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined" #endif #if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ &amp;&amp; defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 #error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 &amp;&amp; BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined" #endif #if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ &amp;&amp; ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING #define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING #endif #if (BOOST_CHRONO_VERSION == 2) #if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ &amp;&amp; ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 #define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 #endif #endif #ifdef BOOST_CHRONO_HEADER_ONLY #define BOOST_CHRONO_INLINE inline #define BOOST_CHRONO_STATIC inline #define BOOST_CHRONO_DECL #else #define BOOST_CHRONO_INLINE #define BOOST_CHRONO_STATIC static // enable dynamic linking on Windows ---------------------------------------// // we need to import/export our code only if the user has specifically // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost // libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK // if they want just this one to be dynamically liked: #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) // export if this is our own source, otherwise import: #ifdef BOOST_CHRONO_SOURCE # define BOOST_CHRONO_DECL BOOST_SYMBOL_EXPORT #else # define BOOST_CHRONO_DECL BOOST_SYMBOL_IMPORT #endif // BOOST_CHRONO_SOURCE #endif // DYN_LINK // // if BOOST_CHRONO_DECL isn't defined yet define it now: #ifndef BOOST_CHRONO_DECL #define BOOST_CHRONO_DECL #endif // enable automatic library variant selection ------------------------------// #if !defined(BOOST_CHRONO_SOURCE) &amp;&amp; !defined(BOOST_ALL_NO_LIB) &amp;&amp; !defined(BOOST_CHRONO_NO_LIB) // // Set the name of our library; this will get undef'ed by auto_link.hpp // once it's done with it: // #define BOOST_LIB_NAME boost_chrono // // If we're importing code from a dll, then tell auto_link.hpp about it: // #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) # define BOOST_DYN_LINK #endif // // And include the header that does the work: // #include &lt;boost/config/auto_link.hpp&gt; #endif // auto-linking disabled #endif // BOOST_CHRONO_HEADER_ONLY #endif // BOOST_CHRONO_CONFIG_HPP </pre> </description> <category>Ticket</category> </item> <item> <author>20313412@…</author> <pubDate>Sun, 25 Jan 2015 14:19:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:21 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:21</guid> <description> <p> following code for chrono.hpp works fine! </p> <pre class="wiki"> #include &lt;time.h&gt; // for clock_gettime namespace boost { namespace chrono { system_clock::time_point system_clock::now() BOOST_NOEXCEPT { timespec ts; if ( ::clock_gettime( CLOCK_REALTIME, &amp;ts ) ) { BOOST_ASSERT(0 &amp;&amp; "Boost::Chrono - Internal Error"); } return time_point(duration( static_cast&lt;system_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING system_clock::time_point system_clock::now(system::error_code &amp; ec) { timespec ts; if ( ::clock_gettime( CLOCK_REALTIME, &amp;ts ) ) { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( system::system_error( errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::system_clock" )); } else { ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); return time_point(); } } if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point(duration( static_cast&lt;system_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); } #endif std::time_t system_clock::to_time_t(const system_clock::time_point&amp; t) BOOST_NOEXCEPT { return static_cast&lt;std::time_t&gt;( t.time_since_epoch().count() / 1000000000 ); } system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT { return time_point(duration(static_cast&lt;system_clock::rep&gt;(t) * 1000000000)); } #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT { #ifdef BOOST_CHRONO_HAS_GETHRTIME hrtime_t hrt = gethrtime(); BOOST_ASSERT(hrt&gt;=0); return time_point(nanoseconds(hrt)); #else timespec ts; if ( ::clock_gettime( CLOCK_MONOTONIC, &amp;ts ) ) { BOOST_ASSERT(0 &amp;&amp; "Boost::Chrono - Internal Error"); } return time_point(duration( static_cast&lt;steady_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); #endif } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING steady_clock::time_point steady_clock::now(system::error_code &amp; ec) { #ifdef BOOST_CHRONO_HAS_GETHRTIME hrtime_t hrt = gethrtime(); if (hrt&lt;0) { boost::throw_exception( system::system_error( EFAULT, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" )); } else { ec.assign( EFAULT, BOOST_CHRONO_SYSTEM_CATEGORY ); return time_point(); } if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point(nanoseconds(hrt)); #else timespec ts; if ( ::clock_gettime( CLOCK_MONOTONIC, &amp;ts ) ) { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( system::system_error( errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" )); } else { ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); return time_point(); } } if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point(duration( static_cast&lt;steady_clock::rep&gt;( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); #endif } #endif #endif } // namespace chrono } // namespace boost </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 25 Jan 2015 14:41:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:22 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:22</guid> <description> <p> Please, add only the changes, not the whole file. Post here the changes you want respect to what I is already in the last version of the fix branch. </p> <p> I wan not say that we have always gethrtime() as the documentation says </p> <pre class="wiki">This API will only be available if the application is being compiled in -Ae mode (extended ANSI) because 64-bit integer numbers are not available in -Aa (ANSI) mode. Please refer to cc(1). </pre><p> I would need a flag that states if the user compiles with option -Ae. </p> <p> The following </p> <pre class="wiki"># elif (defined(__HP_aCC) || defined(__GNUC__)) &amp;&amp; defined(__hpux) </pre><p> is equivalent to my </p> <pre class="wiki"># if BOOST_PLATFORM="HP-UX" </pre><p> Isn't it? </p> </description> <category>Ticket</category> </item> <item> <author>20313412@…</author> <pubDate>Sun, 25 Jan 2015 15:51:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:23 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:23</guid> <description> <p> Sorry, here's the diff result: </p> <pre class="wiki">diff -Nau org/chrono.hpp new/chrono.hpp --- org/chrono.hpp 2015-01-25 23:38:43.724793129 +0800 +++ new/chrono.hpp 2015-01-25 23:38:54.084793418 +0800 @@ -76,7 +76,7 @@ #ifdef BOOST_CHRONO_HAS_GETHRTIME hrtime_t hrt = gethrtime(); BOOST_ASSERT(hrt&gt;=0); - return time_point(nanoseconds(hrt); + return time_point(nanoseconds(hrt)); #else timespec ts; if ( ::clock_gettime( CLOCK_MONOTONIC, &amp;ts ) ) @@ -111,7 +111,7 @@ { ec.clear(); } - return time_point(nanoseconds(hrt); + return time_point(nanoseconds(hrt)); #else timespec ts; if ( ::clock_gettime( CLOCK_MONOTONIC, &amp;ts ) ) diff -Nau org/config.hpp new/config.hpp --- org/config.hpp 2015-01-25 23:38:37.617794648 +0800 +++ new/config.hpp 2015-01-25 23:39:00.701793133 +0800 @@ -84,18 +84,13 @@ # include &lt;time.h&gt; //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME # if defined(CLOCK_MONOTONIC) # define BOOST_CHRONO_HAS_CLOCK_STEADY -# if BOOST_PLATFORM="HP-UX" -# include &lt;user_time.h&gt; //to check for gethrtime +# elif (defined(__HP_aCC) || defined(__GNUC__)) &amp;&amp; defined(__hpux) # if ! defined BOOST_CHRONO_HAS_GETHRTIME -# if defined(WHATEVER_HPUX_SPECIFIC_FLAG_ENSURES_GETHRTIME_WILL_BE_DEFINED) -# define BOOST_CHRONO_HAS_GETHRTIME -# define BOOST_CHRONO_HAS_CLOCK_STEADY -# endif -# else +# define BOOST_CHRONO_HAS_GETHRTIME # define BOOST_CHRONO_HAS_CLOCK_STEADY # endif -# endif # endif + # if defined(_POSIX_THREAD_CPUTIME) &amp;&amp; !defined(BOOST_DISABLE_THREADS) # define BOOST_CHRONO_HAS_THREAD_CLOCK # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true </pre><p> Tomorrow, I'll try to find out the flag corresponding to -Aa and post the result here. I'll also test if <code># if BOOST_PLATFORM="HP-UX"</code> works please hold on </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 25 Jan 2015 17:37:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:24 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:24</guid> <description> <p> Thanks for the diff and the test. Fixed the missing right-parenthesis ). Removed include user_time.h. </p> <p> <a class="ext-link" href="https://github.com/boostorg/chrono/commit/7f817fe8c1a4b0e336e627fa658323e27facc39a"><span class="icon">​</span>https://github.com/boostorg/chrono/commit/7f817fe8c1a4b0e336e627fa658323e27facc39a</a> </p> <p> Yet missing the flag. I could merge this to develop as it works. The single thing the user must do is to define BOOST_CHRONO_HAS_GETHRTIME. This can be documented. </p> <p> What do you think? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 25 Jan 2015 17:43:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:25 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:25</guid> <description> <p> Maybe using BOOST_NO_LONG_LONG </p> <pre class="wiki">The long long 64-bit data type is supported as an extension to the language when you use the -Ae compile-line option. </pre><p> Or whatever specif feature available when option -Ae is present (<a class="ext-link" href="http://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;uact=8&amp;ved=0CB8QFjAA&amp;url=http%3A%2F%2Fh21007.www2.hp.com%2Fportal%2Fdownload%2Ffiles%2Funprot%2Fhpux%2Fhp%2520c%2520hpux%2520reference%2520manual.pdf&amp;ei=DirFVObfLYH4UOjygYAH&amp;usg=AFQjCNFB2onp1PoNR2UzEcKvuBhmWTsBRQ&amp;sig2=Akk7n8_Ha-7RQSPcYHDzrA&amp;bvm=bv.84349003,d.d24"><span class="icon">​</span>http://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;uact=8&amp;ved=0CB8QFjAA&amp;url=http%3A%2F%2Fh21007.www2.hp.com%2Fportal%2Fdownload%2Ffiles%2Funprot%2Fhpux%2Fhp%2520c%2520hpux%2520reference%2520manual.pdf&amp;ei=DirFVObfLYH4UOjygYAH&amp;usg=AFQjCNFB2onp1PoNR2UzEcKvuBhmWTsBRQ&amp;sig2=Akk7n8_Ha-7RQSPcYHDzrA&amp;bvm=bv.84349003,d.d24</a>) </p> </description> <category>Ticket</category> </item> <item> <author>20313412@…</author> <pubDate>Mon, 26 Jan 2015 09:47:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:26 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:26</guid> <description> <p> Hi Viboes, checked HP-UX with following code: </p> <pre class="wiki">#include &lt;/usr/include/time.h&gt; int main() { #ifdef _POSIX_SOURCE long long a = 0; a += 1; hrtime_t begin ; begin = gethrtime(); #endif return 0; } </pre><p> both following cmd line successed </p> <pre class="wiki">cc -g -Ae -o b b.c cc -g -Aa -o b b.c </pre><p> with following code </p> <pre class="wiki">#include &lt;/usr/include/time.h&gt; int main() { long long a = 0; a += 1; hrtime_t begin ; begin = gethrtime(); return 0; } </pre><p> failed to compile with <code> cc -g -Aa -o b b.c</code> err msg: </p> <pre class="wiki">"b.c", line 4: warning #2450-D: the type "long long" is nonstandard long long a = 0; ^ "b.c", line 7: error #2268: declaration may not appear after executable statement in block hrtime_t begin ; ^ "b.c", line 7: error #2020: identifier "hrtime_t" is undefined hrtime_t begin ; ^ 2 errors detected in the compilation of "b.c". </pre><p> but successed with <code> cc -g -Ae -o b b.c</code> </p> <p> so , I think: </p> <ol><li> BOOST_NO_LONG_LONG indicates no -Ae option used in cmd line </li><li> _POSIX_SOURCE indicates -Ae model too </li><li>since {{{In HP-UX 10.20 and earlier releases, compatibility mode is the default </li></ol><p> compilation mode. In HP-UX 10.30 forward, extended ANSI mode (-Ae) is the default}}}, maybe it's not necessary to check -Ae model? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 26 Jan 2015 22:09:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9379#comment:27 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:27</guid> <description> <p> I think about just checking the version, however the default is not forcedly what the user uses ;-) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 21 May 2015 20:48:51 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9379#comment:28 https://svn.boost.org/trac10/ticket/9379#comment:28 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> Ticket anonymous Sun, 04 Dec 2016 16:07:00 GMT version changed https://svn.boost.org/trac10/ticket/9379#comment:29 https://svn.boost.org/trac10/ticket/9379#comment:29 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.55.0</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> Ticket brian.groose@… Mon, 06 Nov 2017 22:29:04 GMT attachment set https://svn.boost.org/trac10/ticket/9379 https://svn.boost.org/trac10/ticket/9379 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ticket9379.patch</span> </li> </ul> <p> Patch for tocket 9379 </p> Ticket brian.groose@… Mon, 06 Nov 2017 22:31:51 GMT <link>https://svn.boost.org/trac10/ticket/9379#comment:30 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9379#comment:30</guid> <description> <p> I know this has been resolved as wontfix, but if there's any chance of this getting fixed, that would be great. I have attached a patch that fixes this for g++ on HPUX, based on previous patches attached and references in this bug. I did not test with aCC since I do not use it. </p> </description> <category>Ticket</category> </item> </channel> </rss>