diff --git a/boost/chrono/config.hpp b/boost/chrono/config.hpp
index 1045ba3a..84eed72c 100644
a
|
b
|
|
84 | 84 | # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME |
85 | 85 | # if defined(CLOCK_MONOTONIC) |
86 | 86 | # define BOOST_CHRONO_HAS_CLOCK_STEADY |
| 87 | # elif defined(__GNUC__) && defined(__hpux) |
| 88 | # define BOOST_CHRONO_HAS_GETHRTIME |
| 89 | # define BOOST_CHRONO_HAS_CLOCK_STEADY |
87 | 90 | # endif |
88 | 91 | # if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS) |
89 | 92 | # define BOOST_CHRONO_HAS_THREAD_CLOCK |
diff --git a/boost/chrono/detail/inlined/posix/chrono.hpp b/boost/chrono/detail/inlined/posix/chrono.hpp
index c4c8a6ad..4046d0e1 100644
a
|
b
|
namespace chrono
|
74 | 74 | |
75 | 75 | steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT |
76 | 76 | { |
| 77 | #ifdef BOOST_CHRONO_HAS_GETHRTIME |
| 78 | hrtime_t hrt = gethrtime(); |
| 79 | BOOST_ASSERT(hrt >= 0); |
| 80 | return time_point(nanoseconds(hrt)); |
| 81 | #else |
77 | 82 | timespec ts; |
78 | 83 | if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) ) |
79 | 84 | { |
… |
… |
namespace chrono
|
82 | 87 | |
83 | 88 | return time_point(duration( |
84 | 89 | static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); |
| 90 | #endif |
85 | 91 | } |
86 | 92 | |
87 | 93 | #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING |
88 | 94 | steady_clock::time_point steady_clock::now(system::error_code & ec) |
89 | 95 | { |
| 96 | #ifdef BOOST_CHRONO_HAS_GETHRTIME |
| 97 | hrtime_t hrt = gethrtime(); |
| 98 | if (hrt < 0) |
| 99 | { |
| 100 | boost::throw_exception( |
| 101 | system::system_error( |
| 102 | EFAULT, |
| 103 | BOOST_CHRONO_SYSTEM_CATEGORY, |
| 104 | "chrono::steady_clock" )); |
| 105 | } |
| 106 | else |
| 107 | { |
| 108 | ec.assign( EFAULT, BOOST_CHRONO_SYSTEM_CATEGORY ); |
| 109 | return time_point(); |
| 110 | } |
| 111 | if (!BOOST_CHRONO_IS_THROWS(ec)) |
| 112 | { |
| 113 | ec.clear(); |
| 114 | } |
| 115 | return time_point(nanoseconds(hrt)); |
| 116 | #else |
90 | 117 | timespec ts; |
91 | 118 | if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) ) |
92 | 119 | { |
… |
… |
namespace chrono
|
111 | 138 | } |
112 | 139 | return time_point(duration( |
113 | 140 | static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); |
| 141 | #endif |
114 | 142 | } |
115 | 143 | #endif |
116 | 144 | #endif |