summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/boost/timer/src
diff options
context:
space:
mode:
authorrobot-contrib <[email protected]>2022-08-10 16:40:38 +0300
committerrobot-contrib <[email protected]>2022-08-10 16:40:38 +0300
commit36029f20e99f6219d4fb0822e0d613a9d6a57aac (patch)
tree8945b9fcdf3e570673f912a26780826404c2685f /contrib/restricted/boost/timer/src
parent8c70d6f947c5f278c665b548cd583e9844e6d7ad (diff)
Update contrib/restricted/boost/type_index to 1.79.0
Diffstat (limited to 'contrib/restricted/boost/timer/src')
-rw-r--r--contrib/restricted/boost/timer/src/cpu_timer.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/contrib/restricted/boost/timer/src/cpu_timer.cpp b/contrib/restricted/boost/timer/src/cpu_timer.cpp
index 0802e985609..36b2ac40726 100644
--- a/contrib/restricted/boost/timer/src/cpu_timer.cpp
+++ b/contrib/restricted/boost/timer/src/cpu_timer.cpp
@@ -18,6 +18,7 @@
#include <boost/io/ios_state.hpp>
#include <boost/throw_exception.hpp>
#include <boost/cerrno.hpp>
+#include <boost/predef.h>
#include <cstring>
#include <sstream>
#include <cassert>
@@ -33,7 +34,6 @@
using boost::timer::nanosecond_type;
using boost::timer::cpu_times;
-using boost::system::error_code;
namespace
{
@@ -94,24 +94,25 @@ namespace
}
# if defined(BOOST_POSIX_API)
+
+ boost::int_least64_t tick_factor_()
+ {
+ boost::int_least64_t tf = ::sysconf( _SC_CLK_TCK );
+ if( tf <= 0 ) return -1;
+
+ tf = INT64_C(1000000000) / tf; // compute factor
+ if( tf == 0 ) tf = -1;
+
+ return tf;
+ }
+
boost::int_least64_t tick_factor() // multiplier to convert ticks
// to nanoseconds; -1 if unknown
{
- static boost::int_least64_t tick_factor = 0;
- if (!tick_factor)
- {
- if ((tick_factor = ::sysconf(_SC_CLK_TCK)) <= 0)
- tick_factor = -1;
- else
- {
- assert(tick_factor <= INT64_C(1000000000)); // logic doesn't handle large ticks
- tick_factor = INT64_C(1000000000) / tick_factor; // compute factor
- if (!tick_factor)
- tick_factor = -1;
- }
- }
- return tick_factor;
+ static boost::int_least64_t tf = tick_factor_();
+ return tf;
}
+
# endif
void get_cpu_times(boost::timer::cpu_times& current)
@@ -122,6 +123,7 @@ namespace
# if defined(BOOST_WINDOWS_API)
+# if BOOST_PLAT_WINDOWS_DESKTOP || defined(__CYGWIN__)
FILETIME creation, exit;
if (::GetProcessTimes(::GetCurrentProcess(), &creation, &exit,
(LPFILETIME)&current.system, (LPFILETIME)&current.user))
@@ -130,6 +132,7 @@ namespace
current.system *= 100;
}
else
+# endif
{
current.system = current.user = boost::timer::nanosecond_type(-1);
}