updated boost on windows
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <time.h> // for clock_gettime
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/predef/os.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -36,22 +37,22 @@ namespace chrono
|
||||
timespec ts;
|
||||
if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::system_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
|
||||
if (!BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (!::boost::chrono::is_throws(ec))
|
||||
{
|
||||
ec.clear();
|
||||
}
|
||||
@@ -75,11 +76,20 @@ namespace chrono
|
||||
steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT
|
||||
{
|
||||
timespec ts;
|
||||
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
|
||||
#if BOOST_OS_CYGWIN
|
||||
// lack of thread safety in high resolution timer initialization
|
||||
// can lead to a timespec of zero without an error; was reported
|
||||
// to the cygwin mailing list and can be removed once fixed
|
||||
do
|
||||
{
|
||||
BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
|
||||
}
|
||||
|
||||
#endif
|
||||
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
|
||||
{
|
||||
BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
|
||||
}
|
||||
#if BOOST_OS_CYGWIN
|
||||
} while (ts.tv_sec == 0 && ts.tv_nsec == 0);
|
||||
#endif
|
||||
return time_point(duration(
|
||||
static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
|
||||
}
|
||||
@@ -88,24 +98,34 @@ namespace chrono
|
||||
steady_clock::time_point steady_clock::now(system::error_code & ec)
|
||||
{
|
||||
timespec ts;
|
||||
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
|
||||
#if BOOST_OS_CYGWIN
|
||||
// lack of thread safety in high resolution timer initialization
|
||||
// can lead to a timespec of zero without an error; was reported
|
||||
// to the cygwin mailing list and can be removed once fixed
|
||||
do
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
#endif
|
||||
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
|
||||
{
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::steady_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
}
|
||||
#if BOOST_OS_CYGWIN
|
||||
} while (ts.tv_sec == 0 && ts.tv_nsec == 0);
|
||||
#endif
|
||||
|
||||
if (!BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (!::boost::chrono::is_throws(ec))
|
||||
{
|
||||
ec.clear();
|
||||
}
|
||||
|
||||
@@ -73,17 +73,17 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now(
|
||||
clock_t c = ::times( &tm );
|
||||
if ( c == clock_t(-1) ) // error
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::process_real_cpu_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now(
|
||||
{
|
||||
if ( chrono_detail::tick_factor() != -1 )
|
||||
{
|
||||
if (!BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (!::boost::chrono::is_throws(ec))
|
||||
{
|
||||
ec.clear();
|
||||
}
|
||||
@@ -100,17 +100,17 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::process_real_cpu_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
@@ -149,17 +149,17 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now(
|
||||
clock_t c = ::times( &tm );
|
||||
if ( c == clock_t(-1) ) // error
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::process_user_cpu_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now(
|
||||
{
|
||||
if ( chrono_detail::tick_factor() != -1 )
|
||||
{
|
||||
if (!BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (!::boost::chrono::is_throws(ec))
|
||||
{
|
||||
ec.clear();
|
||||
}
|
||||
@@ -176,17 +176,17 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::process_user_cpu_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
@@ -226,17 +226,17 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now(
|
||||
clock_t c = ::times( &tm );
|
||||
if ( c == clock_t(-1) ) // error
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::process_system_cpu_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now(
|
||||
{
|
||||
if ( chrono_detail::tick_factor() != -1 )
|
||||
{
|
||||
if (!BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (!::boost::chrono::is_throws(ec))
|
||||
{
|
||||
ec.clear();
|
||||
}
|
||||
@@ -253,17 +253,17 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::process_system_cpu_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
@@ -306,17 +306,17 @@ process_cpu_clock::time_point process_cpu_clock::now(
|
||||
clock_t c = ::times( &tm );
|
||||
if ( c == clock_t(-1) ) // error
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::process_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
@@ -332,17 +332,17 @@ process_cpu_clock::time_point process_cpu_clock::now(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::process_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,21 +65,21 @@ namespace boost { namespace chrono {
|
||||
if ( ::clock_gettime( clock_id, &ts ) )
|
||||
#endif
|
||||
{
|
||||
if (BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (::boost::chrono::is_throws(ec))
|
||||
{
|
||||
boost::throw_exception(
|
||||
system::system_error(
|
||||
errno,
|
||||
BOOST_CHRONO_SYSTEM_CATEGORY,
|
||||
::boost::system::system_category(),
|
||||
"chrono::thread_clock" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
|
||||
ec.assign( errno, ::boost::system::system_category() );
|
||||
return time_point();
|
||||
}
|
||||
}
|
||||
if (!BOOST_CHRONO_IS_THROWS(ec))
|
||||
if (!::boost::chrono::is_throws(ec))
|
||||
{
|
||||
ec.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user