Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9379: 'boost::chrono::steady_clock' has not been declared" on boost 1.55, hp-ux 11.23 IA, gcc 4.6
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-01-25 08:10:18
#9379: 'boost::chrono::steady_clock' has not been declared" on boost 1.55, hp-ux
11.23 IA, gcc 4.6
-------------------------------+--------------------------
Reporter: gengyonghui@⦠| Owner: viboes
Type: Bugs | Status: reopened
Milestone: To Be Determined | Component: chrono
Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords: steady_clock
-------------------------------+--------------------------
Comment (by viboes):
Once you have found the flag, we can continue with
{{{
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, &ts ) )
{
@@ -81,20 +84,25 @@ namespace chrono
return time_point(duration(
static_cast<steady_clock::rep>( 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 & ec)
{
+#ifdef BOOST_CHRONO_HAS_GETHRTIME
+ ec.clear();
+ return time_point(nanoseconds(gethrtime());
+#else
timespec ts;
if ( ::clock_gettime( CLOCK_MONOTONIC, &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<steady_clock::rep>( ts.tv_sec ) * 1000000000 +
ts.tv_nsec));
+#endif
}
#endif
#endif
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9379#comment:15> 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:17 UTC