summaryrefslogtreecommitdiff
path: root/boost/chrono
diff options
context:
space:
mode:
Diffstat (limited to 'boost/chrono')
-rw-r--r--boost/chrono/duration.hpp58
-rw-r--r--boost/chrono/io/duration_io.hpp2
-rw-r--r--boost/chrono/io/time_point_io.hpp18
-rw-r--r--boost/chrono/io/time_point_units.hpp2
-rw-r--r--boost/chrono/process_cpu_clocks.hpp4
-rw-r--r--boost/chrono/time_point.hpp1
6 files changed, 42 insertions, 43 deletions
diff --git a/boost/chrono/duration.hpp b/boost/chrono/duration.hpp
index 737328c418..0a09674f1a 100644
--- a/boost/chrono/duration.hpp
+++ b/boost/chrono/duration.hpp
@@ -433,12 +433,13 @@ namespace chrono {
rep rep_;
public:
-#if defined BOOST_NO_CXX11_DEFAULTED_FUNCTIONS || \
- defined BOOST_CHRONO_DURATION_DEFAULTS_TO_ZERO
+#if defined BOOST_CHRONO_DURATION_DEFAULTS_TO_ZERO
BOOST_FORCEINLINE BOOST_CONSTEXPR
duration() : rep_(duration_values<rep>::zero()) { }
+#elif defined BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
+ BOOST_CONSTEXPR duration() {}
#else
- BOOST_CONSTEXPR duration() BOOST_NOEXCEPT : rep_() {};
+ BOOST_CONSTEXPR duration() = default;
#endif
template <class Rep2>
BOOST_SYMBOL_VISIBLE BOOST_FORCEINLINE BOOST_CONSTEXPR
@@ -542,8 +543,8 @@ namespace chrono {
const duration<Rep2, Period2>& rhs)
{
typedef typename common_type<duration<Rep1, Period1>,
- duration<Rep2, Period2> >::type CD;
- return CD(CD(lhs).count()+CD(rhs).count());
+ duration<Rep2, Period2> >::type common_duration;
+ return common_duration(common_duration(lhs).count()+common_duration(rhs).count());
}
// Duration -
@@ -555,8 +556,8 @@ namespace chrono {
const duration<Rep2, Period2>& rhs)
{
typedef typename common_type<duration<Rep1, Period1>,
- duration<Rep2, Period2> >::type CD;
- return CD(CD(lhs).count()-CD(rhs).count());
+ duration<Rep2, Period2> >::type common_duration;
+ return common_duration(common_duration(lhs).count()-common_duration(rhs).count());
}
// Duration *
@@ -572,9 +573,9 @@ namespace chrono {
>::type
operator*(const duration<Rep1, Period>& d, const Rep2& s)
{
- typedef typename common_type<Rep1, Rep2>::type CR;
- typedef duration<CR, Period> CD;
- return CD(CD(d).count()*static_cast<CR>(s));
+ typedef typename common_type<Rep1, Rep2>::type common_rep;
+ typedef duration<common_rep, Period> common_duration;
+ return common_duration(common_duration(d).count()*static_cast<common_rep>(s));
}
template <class Rep1, class Period, class Rep2>
@@ -601,10 +602,9 @@ namespace chrono {
>::type
operator/(const duration<Rep1, Period>& d, const Rep2& s)
{
- typedef typename common_type<Rep1, Rep2>::type CR;
- typedef duration<CR, Period> CD;
-
- return CD(CD(d).count()/static_cast<CR>(s));
+ typedef typename common_type<Rep1, Rep2>::type common_rep;
+ typedef duration<common_rep, Period> common_duration;
+ return common_duration(common_duration(d).count()/static_cast<common_rep>(s));
}
template <class Rep1, class Period1, class Rep2, class Period2>
@@ -613,8 +613,8 @@ namespace chrono {
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs)
{
typedef typename common_type<duration<Rep1, Period1>,
- duration<Rep2, Period2> >::type CD;
- return CD(lhs).count() / CD(rhs).count();
+ duration<Rep2, Period2> >::type common_duration;
+ return common_duration(lhs).count() / common_duration(rhs).count();
}
#ifdef BOOST_CHRONO_EXTENSIONS
@@ -626,10 +626,9 @@ namespace chrono {
>::type
operator/(const Rep1& s, const duration<Rep2, Period>& d)
{
- typedef typename common_type<Rep1, Rep2>::type CR;
- typedef duration<CR, Period> CD;
-
- return static_cast<CR>(s)/CD(d).count();
+ typedef typename common_type<Rep1, Rep2>::type common_rep;
+ typedef duration<common_rep, Period> common_duration;
+ return static_cast<common_rep>(s)/common_duration(d).count();
}
#endif
// Duration %
@@ -642,10 +641,9 @@ namespace chrono {
>::type
operator%(const duration<Rep1, Period>& d, const Rep2& s)
{
- typedef typename common_type<Rep1, Rep2>::type CR;
- typedef duration<CR, Period> CD;
-
- return CD(CD(d).count()%static_cast<CR>(s));
+ typedef typename common_type<Rep1, Rep2>::type common_rep;
+ typedef duration<common_rep, Period> common_duration;
+ return common_duration(common_duration(d).count()%static_cast<common_rep>(s));
}
template <class Rep1, class Period1, class Rep2, class Period2>
@@ -654,9 +652,9 @@ namespace chrono {
operator%(const duration<Rep1, Period1>& lhs,
const duration<Rep2, Period2>& rhs) {
typedef typename common_type<duration<Rep1, Period1>,
- duration<Rep2, Period2> >::type CD;
+ duration<Rep2, Period2> >::type common_duration;
- return CD(CD(lhs).count()%CD(rhs).count());
+ return common_duration(common_duration(lhs).count()%common_duration(rhs).count());
}
@@ -671,8 +669,8 @@ namespace detail
{
BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) const
{
- typedef typename common_type<LhsDuration, RhsDuration>::type CD;
- return CD(lhs).count() == CD(rhs).count();
+ typedef typename common_type<LhsDuration, RhsDuration>::type common_duration;
+ return common_duration(lhs).count() == common_duration(rhs).count();
}
};
@@ -690,8 +688,8 @@ namespace detail
{
BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) const
{
- typedef typename common_type<LhsDuration, RhsDuration>::type CD;
- return CD(lhs).count() < CD(rhs).count();
+ typedef typename common_type<LhsDuration, RhsDuration>::type common_duration;
+ return common_duration(lhs).count() < common_duration(rhs).count();
}
};
diff --git a/boost/chrono/io/duration_io.hpp b/boost/chrono/io/duration_io.hpp
index 34004484f3..f3aca6adfd 100644
--- a/boost/chrono/io/duration_io.hpp
+++ b/boost/chrono/io/duration_io.hpp
@@ -21,7 +21,7 @@
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <locale>
-#include <iostream>
+#include <iosfwd>
#include <sstream>
namespace boost
diff --git a/boost/chrono/io/time_point_io.hpp b/boost/chrono/io/time_point_io.hpp
index 0cbc275c0e..ef51210bd8 100644
--- a/boost/chrono/io/time_point_io.hpp
+++ b/boost/chrono/io/time_point_io.hpp
@@ -34,20 +34,22 @@
#include <locale>
#include <ctime>
-#define BOOST_CHRONO_INTERNAL_TIMEGM \
- ( defined BOOST_WINDOWS && ! defined(__CYGWIN__) ) \
+#if ( defined BOOST_WINDOWS && ! defined(__CYGWIN__) ) \
|| (defined(sun) || defined(__sun)) \
|| (defined __IBMCPP__) \
|| defined __ANDROID__ \
|| defined __QNXNTO__ \
|| (defined(_AIX) && defined __GNUC__)
+#define BOOST_CHRONO_INTERNAL_TIMEGM
+#endif
-#define BOOST_CHRONO_INTERNAL_GMTIME \
- (defined BOOST_WINDOWS && ! defined(__CYGWIN__)) \
+#if (defined BOOST_WINDOWS && ! defined(__CYGWIN__)) \
|| ( (defined(sun) || defined(__sun)) && defined __GNUC__) \
|| (defined __IBMCPP__) \
|| defined __ANDROID__ \
|| (defined(_AIX) && defined __GNUC__)
+#define BOOST_CHRONO_INTERNAL_GMTIME
+#endif
#define BOOST_CHRONO_USES_INTERNAL_TIME_GET
@@ -746,7 +748,7 @@ namespace boost
namespace detail
{
-//#if BOOST_CHRONO_INTERNAL_TIMEGM
+//#if defined BOOST_CHRONO_INTERNAL_TIMEGM
inline int32_t is_leap(int32_t year)
{
@@ -949,7 +951,7 @@ namespace boost
}
else
{
-#if BOOST_CHRONO_INTERNAL_GMTIME
+#if defined BOOST_CHRONO_INTERNAL_GMTIME
if (detail::internal_gmtime(&t, &tm) == 0) failed = true;
#elif defined BOOST_WINDOWS && ! defined(__CYGWIN__)
@@ -1157,7 +1159,7 @@ namespace boost
if (err & std::ios_base::failbit) goto exit;
time_t t;
-#if BOOST_CHRONO_INTERNAL_TIMEGM
+#if defined BOOST_CHRONO_INTERNAL_TIMEGM
t = detail::internal_timegm(&tm);
#else
t = timegm(&tm);
@@ -1209,7 +1211,7 @@ namespace boost
time_t t;
if (tz == timezone::utc || fz != pe)
{
-#if BOOST_CHRONO_INTERNAL_TIMEGM
+#if defined BOOST_CHRONO_INTERNAL_TIMEGM
t = detail::internal_timegm(&tm);
#else
t = timegm(&tm);
diff --git a/boost/chrono/io/time_point_units.hpp b/boost/chrono/io/time_point_units.hpp
index 7aef8526da..6a4999a5e5 100644
--- a/boost/chrono/io/time_point_units.hpp
+++ b/boost/chrono/io/time_point_units.hpp
@@ -15,7 +15,7 @@
#include <boost/chrono/thread_clock.hpp>
#include <boost/chrono/io/ios_base_state.hpp>
#include <string>
-#include <iostream>
+#include <iosfwd>
#include <ios>
#include <locale>
#include <algorithm>
diff --git a/boost/chrono/process_cpu_clocks.hpp b/boost/chrono/process_cpu_clocks.hpp
index ca6bef38e9..93d3c94ac8 100644
--- a/boost/chrono/process_cpu_clocks.hpp
+++ b/boost/chrono/process_cpu_clocks.hpp
@@ -20,7 +20,7 @@
#include <boost/chrono/time_point.hpp>
#include <boost/operators.hpp>
#include <boost/chrono/detail/system.hpp>
-#include <iostream>
+#include <iosfwd>
#include <boost/type_traits/common_type.hpp>
#include <boost/chrono/clock_string.hpp>
@@ -476,7 +476,7 @@ namespace std {
(std::numeric_limits<Rep>::max)(),
(std::numeric_limits<Rep>::max)());
}
- static Res lowest() throw()
+ static Res lowest() BOOST_NOEXCEPT_OR_NOTHROW
{
return (min)();
}
diff --git a/boost/chrono/time_point.hpp b/boost/chrono/time_point.hpp
index 6449fac6e1..fc230955d9 100644
--- a/boost/chrono/time_point.hpp
+++ b/boost/chrono/time_point.hpp
@@ -31,7 +31,6 @@ time2_demo contained this comment:
#define BOOST_CHRONO_TIME_POINT_HPP
#include <boost/chrono/duration.hpp>
-#include <iostream>
#ifndef BOOST_CHRONO_HEADER_ONLY
// this must occur after all of the includes and before any code appears: