|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85829 - in trunk: boost/sync/detail boost/sync/support libs/sync/test/run
From: andrey.semashev_at_[hidden]
Date: 2013-09-22 08:48:29
Author: andysem
Date: 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013)
New Revision: 85829
URL: http://svn.boost.org/trac/boost/changeset/85829
Log:
Added support for more time libraries.
Added:
trunk/boost/sync/support/boost_chrono.hpp (contents, props changed)
trunk/boost/sync/support/boost_date_time.hpp
- copied, changed from r85812, trunk/boost/sync/support/date_time.hpp
trunk/boost/sync/support/posix_time.hpp (contents, props changed)
trunk/boost/sync/support/std_chrono.hpp (contents, props changed)
trunk/libs/sync/test/run/chrono_system_clock_time_t_mismatch.cpp (contents, props changed)
Deleted:
trunk/boost/sync/support/date_time.hpp
Text files modified:
trunk/boost/sync/detail/time_units.hpp | 64 +++++++++++++++------------
trunk/boost/sync/support/boost_chrono.hpp | 85 +++++++++++++++++++++++++++++++++++++
trunk/boost/sync/support/boost_date_time.hpp | 23 ++-------
/dev/null | 91 ----------------------------------------
trunk/boost/sync/support/posix_time.hpp | 55 ++++++++++++++++++++++++
trunk/boost/sync/support/std_chrono.hpp | 88 ++++++++++++++++++++++++++++++++++++++
trunk/libs/sync/test/run/chrono_system_clock_time_t_mismatch.cpp | 41 ++++++++++++++++++
trunk/libs/sync/test/run/mutex_test.cpp | 2
8 files changed, 310 insertions(+), 139 deletions(-)
Modified: trunk/boost/sync/detail/time_units.hpp
==============================================================================
--- trunk/boost/sync/detail/time_units.hpp Sun Sep 22 08:23:26 2013 (r85828)
+++ trunk/boost/sync/detail/time_units.hpp 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013) (r85829)
@@ -51,32 +51,32 @@
native_type m_value;
public:
- system_duration() : m_value(0) {}
- explicit system_duration(native_type value) : m_value(value) {}
+ BOOST_CONSTEXPR system_duration() BOOST_NOEXCEPT : m_value(0) {}
+ explicit system_duration(native_type value) BOOST_NOEXCEPT : m_value(value) {}
- native_type get() const { return m_value; }
+ native_type get() const BOOST_NOEXCEPT { return m_value; }
- system_duration& operator+= (system_duration const& that)
+ system_duration& operator+= (system_duration const& that) BOOST_NOEXCEPT
{
m_value += that.m_value;
return *this;
}
- system_duration& operator-= (system_duration const& that)
+ system_duration& operator-= (system_duration const& that) BOOST_NOEXCEPT
{
m_value -= that.m_value;
return *this;
}
- system_duration operator- () const
+ system_duration operator- () const BOOST_NOEXCEPT
{
return system_duration(-m_value);
}
- friend system_duration operator+ (system_duration left, system_duration const& right)
+ friend system_duration operator+ (system_duration left, system_duration const& right) BOOST_NOEXCEPT
{
left += right;
return left;
}
- friend system_duration operator- (system_duration left, system_duration const& right)
+ friend system_duration operator- (system_duration left, system_duration const& right) BOOST_NOEXCEPT
{
left -= right;
return left;
@@ -96,16 +96,21 @@
native_type m_value;
public:
- system_time_point() : m_value() {}
- explicit system_time_point(time_t t, unsigned int subsecond = 0)
+ BOOST_CONSTEXPR system_time_point() BOOST_NOEXCEPT : m_value() {}
+ explicit system_time_point(time_t t, unsigned int subsecond = 0) BOOST_NOEXCEPT
{
m_value.tv_sec = t;
m_value.tv_nsec = subsecond;
}
+ explicit system_time_point(system_duration dur) BOOST_NOEXCEPT
+ {
+ m_value.tv_sec = dur.get() / subsecond_fraction;
+ m_value.tv_nsec = dur.get() % subsecond_fraction;
+ }
- native_type const& get() const { return m_value; }
+ native_type const& get() const BOOST_NOEXCEPT { return m_value; }
- static system_time_point now()
+ static system_time_point now() BOOST_NOEXCEPT
{
#if defined(BOOST_HAS_CLOCK_GETTIME)
system_time_point t;
@@ -116,7 +121,7 @@
#endif
}
- system_time_point& operator+= (system_duration const& dur)
+ system_time_point& operator+= (system_duration const& dur) BOOST_NOEXCEPT
{
int64_t nsec = static_cast< int64_t >(m_value.tv_nsec) + dur.get();
int64_t tv_nsec = nsec % system_duration::subsecond_fraction;
@@ -130,23 +135,23 @@
return *this;
}
- system_time_point& operator-= (system_duration const& dur)
+ system_time_point& operator-= (system_duration const& dur) BOOST_NOEXCEPT
{
return operator+= (-dur);
}
- friend system_time_point operator+ (system_time_point left, system_duration const& right)
+ friend system_time_point operator+ (system_time_point left, system_duration const& right) BOOST_NOEXCEPT
{
left += right;
return left;
}
- friend system_time_point operator- (system_time_point left, system_duration const& right)
+ friend system_time_point operator- (system_time_point left, system_duration const& right) BOOST_NOEXCEPT
{
left -= right;
return left;
}
- friend system_duration operator- (system_time_point const& left, system_time_point const& right)
+ friend system_duration operator- (system_time_point const& left, system_time_point const& right) BOOST_NOEXCEPT
{
int64_t seconds = static_cast< int64_t >(left.m_value.tv_sec) - static_cast< int64_t >(right.m_value.tv_sec);
int64_t nseconds = static_cast< int64_t >(left.m_value.tv_nsec) - static_cast< int64_t >(right.m_value.tv_nsec);
@@ -167,14 +172,17 @@
native_type m_value;
public:
- system_time_point() : m_value(0) {}
- explicit system_time_point(time_t t, unsigned int subsecond = 0) : m_value(static_cast< uint64_t >(t) * subsecond_fraction + subsecond)
+ BOOST_CONSTEXPR system_time_point() BOOST_NOEXCEPT : m_value(0) {}
+ explicit system_time_point(time_t t, unsigned int subsecond = 0) BOOST_NOEXCEPT : m_value(static_cast< uint64_t >(t) * subsecond_fraction + subsecond)
+ {
+ }
+ explicit system_time_point(system_duration dur) BOOST_NOEXCEPT : m_value(dur.get())
{
}
- native_type const& get() const { return m_value; }
+ native_type const& get() const BOOST_NOEXCEPT { return m_value; }
- static system_time_point now()
+ static system_time_point now() BOOST_NOEXCEPT
{
union
{
@@ -191,34 +199,32 @@
// Convert to milliseconds
caster.as_uint64 /= 10000u;
- system_time_point res;
- res.m_value = caster.as_uint64;
- return res;
+ return system_time_point(system_duration(caster.as_uint64));
}
- system_time_point& operator+= (system_duration const& dur)
+ system_time_point& operator+= (system_duration const& dur) BOOST_NOEXCEPT
{
m_value += dur.get();
return *this;
}
- system_time_point& operator-= (system_duration const& dur)
+ system_time_point& operator-= (system_duration const& dur) BOOST_NOEXCEPT
{
m_value -= dur.get();
return *this;
}
- friend system_time_point operator+ (system_time_point left, system_duration const& right)
+ friend system_time_point operator+ (system_time_point left, system_duration const& right) BOOST_NOEXCEPT
{
left += right;
return left;
}
- friend system_time_point operator- (system_time_point left, system_duration const& right)
+ friend system_time_point operator- (system_time_point left, system_duration const& right) BOOST_NOEXCEPT
{
left -= right;
return left;
}
- friend system_duration operator- (system_time_point const& left, system_time_point const& right)
+ friend system_duration operator- (system_time_point const& left, system_time_point const& right) BOOST_NOEXCEPT
{
return system_duration(static_cast< system_duration::native_type >(left.m_value - right.m_value));
}
Added: trunk/boost/sync/support/boost_chrono.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/sync/support/boost_chrono.hpp 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013) (r85829)
@@ -0,0 +1,85 @@
+/*
+ * Copyright Andrey Semashev 2013.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file support/boost_chrono.hpp
+ *
+ * \brief This header enables support for Boost.Chrono time units.
+ */
+
+#ifndef BOOST_SYNC_SUPPORT_BOOST_CHRONO_HPP_INCLUDED_
+#define BOOST_SYNC_SUPPORT_BOOST_CHRONO_HPP_INCLUDED_
+
+#include <boost/ratio/ratio.hpp>
+#include <boost/chrono/duration.hpp>
+#include <boost/chrono/time_point.hpp>
+#include <boost/chrono/system_clocks.hpp>
+#include <boost/sync/detail/config.hpp>
+#include <boost/sync/detail/time_traits.hpp>
+#include <boost/sync/detail/time_units.hpp>
+#include <boost/sync/detail/header.hpp>
+
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+namespace boost {
+
+namespace sync {
+
+namespace detail {
+
+template< typename Rep, typename Period >
+struct time_traits< boost::chrono::duration< Rep, Period > >
+{
+ typedef time_duration_tag tag;
+
+ static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
+
+ static system_duration to_sync_unit(boost::chrono::duration< Rep, Period > const& dur) BOOST_NOEXCEPT
+ {
+ typedef boost::chrono::duration< system_duration::native_type, boost::ratio< 1, system_duration::subsecond_fraction > > system_chrono_duration;
+ return system_duration(boost::chrono::duration_cast< system_chrono_duration >(dur).count());
+ }
+};
+
+template< typename Clock, typename Duration >
+struct time_traits< boost::chrono::time_point< Clock, Duration > >
+{
+ typedef time_point_tag tag;
+
+ static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
+
+ static chrono_time_point< boost::chrono::time_point< Clock, Duration > > to_sync_unit(boost::chrono::time_point< Clock, Duration > const& point) BOOST_NOEXCEPT
+ {
+ return chrono_time_point< boost::chrono::time_point< Clock, Duration > >(point);
+ }
+};
+
+template< typename Duration >
+struct time_traits< boost::chrono::time_point< boost::chrono::system_clock, Duration > >
+{
+ typedef time_point_tag tag;
+
+ static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
+
+ static system_time_point to_sync_unit(boost::chrono::time_point< boost::chrono::system_clock, Duration > const& point) BOOST_NOEXCEPT
+ {
+ typedef typename boost::chrono::time_point< boost::chrono::system_clock, Duration >::duration duration;
+ // system_clock in Boost.Chrono always have epoch at 1st January 1970
+ return system_time_point(time_traits< duration >::to_sync_unit(point.time_since_epoch()));
+ }
+};
+
+} // namespace detail
+
+} // namespace sync
+
+} // namespace boost
+
+#include <boost/sync/detail/footer.hpp>
+
+#endif // BOOST_SYNC_SUPPORT_BOOST_CHRONO_HPP_INCLUDED_
Copied and modified: trunk/boost/sync/support/boost_date_time.hpp (from r85812, trunk/boost/sync/support/date_time.hpp)
==============================================================================
--- trunk/boost/sync/support/date_time.hpp Sat Sep 21 15:26:42 2013 (r85812, copy source)
+++ trunk/boost/sync/support/boost_date_time.hpp 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013) (r85829)
@@ -5,15 +5,14 @@
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
- * \file support/date_time.hpp
+ * \file support/boost_date_time.hpp
*
* \brief This header enables support for Boost.DateTime time units.
*/
-#ifndef BOOST_SYNC_SUPPORT_DATE_TIME_HPP_INCLUDED_
-#define BOOST_SYNC_SUPPORT_DATE_TIME_HPP_INCLUDED_
+#ifndef BOOST_SYNC_SUPPORT_BOOST_DATE_TIME_HPP_INCLUDED_
+#define BOOST_SYNC_SUPPORT_BOOST_DATE_TIME_HPP_INCLUDED_
-#include <ctime>
#include <boost/cstdint.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/sync/detail/config.hpp>
@@ -64,19 +63,7 @@
typedef typename T::date_type date_type;
typedef typename T::time_duration_type time_duration_type;
time_duration_type dur = point - T(date_type(1970, 1, 1));
-
- std::time_t seconds = dur.total_seconds();
- uint64_t fractional_seconds = dur.fractional_seconds();
-
- typedef typename time_duration_type::traits_type traits_type;
- enum
- {
- conversion_ratio = traits_type::ticks_per_second >= system_time_point::subsecond_fraction ?
- traits_type::ticks_per_second / system_time_point::subsecond_fraction :
- system_time_point::subsecond_fraction / traits_type::ticks_per_second
- };
- return system_time_point(seconds, traits_type::ticks_per_second >= system_time_point::subsecond_fraction ?
- fractional_seconds / conversion_ratio : fractional_seconds * conversion_ratio);
+ return system_time_point(time_traits< time_duration_type >::to_sync_unit(dur));
}
};
@@ -88,4 +75,4 @@
#include <boost/sync/detail/footer.hpp>
-#endif // BOOST_SYNC_SUPPORT_DATE_TIME_HPP_INCLUDED_
+#endif // BOOST_SYNC_SUPPORT_BOOST_DATE_TIME_HPP_INCLUDED_
Deleted: trunk/boost/sync/support/date_time.hpp
==============================================================================
--- trunk/boost/sync/support/date_time.hpp 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013) (r85828)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,91 +0,0 @@
-/*
- * Copyright Andrey Semashev 2013.
- * Distributed under the Boost Software License, Version 1.0.
- * (See accompanying file LICENSE_1_0.txt or copy at
- * http://www.boost.org/LICENSE_1_0.txt)
- */
-/*!
- * \file support/date_time.hpp
- *
- * \brief This header enables support for Boost.DateTime time units.
- */
-
-#ifndef BOOST_SYNC_SUPPORT_DATE_TIME_HPP_INCLUDED_
-#define BOOST_SYNC_SUPPORT_DATE_TIME_HPP_INCLUDED_
-
-#include <ctime>
-#include <boost/cstdint.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-#include <boost/sync/detail/config.hpp>
-#include <boost/sync/detail/time_traits.hpp>
-#include <boost/sync/detail/time_units.hpp>
-#include <boost/sync/detail/header.hpp>
-
-#ifdef BOOST_HAS_PRAGMA_ONCE
-#pragma once
-#endif
-
-namespace boost {
-
-namespace sync {
-
-namespace detail {
-
-template< typename T >
-struct time_traits< T, typename T::_is_boost_date_time_duration >
-{
- typedef time_duration_tag tag;
-
- static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
-
- static system_duration to_sync_unit(T const& dur)
- {
- typedef typename T::traits_type traits_type;
- enum
- {
- conversion_ratio = traits_type::ticks_per_second >= system_duration::subsecond_fraction ?
- traits_type::ticks_per_second / system_duration::subsecond_fraction :
- system_duration::subsecond_fraction / traits_type::ticks_per_second
- };
- return system_duration(traits_type::ticks_per_second >= system_duration::subsecond_fraction ?
- dur.ticks() / conversion_ratio : dur.ticks() * conversion_ratio);
- }
-};
-
-template< typename T >
-struct time_traits< T, typename T::_is_boost_date_time_time_point >
-{
- typedef time_point_tag tag;
-
- static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
-
- static system_time_point to_sync_unit(T const& point)
- {
- typedef typename T::date_type date_type;
- typedef typename T::time_duration_type time_duration_type;
- time_duration_type dur = point - T(date_type(1970, 1, 1));
-
- std::time_t seconds = dur.total_seconds();
- uint64_t fractional_seconds = dur.fractional_seconds();
-
- typedef typename time_duration_type::traits_type traits_type;
- enum
- {
- conversion_ratio = traits_type::ticks_per_second >= system_time_point::subsecond_fraction ?
- traits_type::ticks_per_second / system_time_point::subsecond_fraction :
- system_time_point::subsecond_fraction / traits_type::ticks_per_second
- };
- return system_time_point(seconds, traits_type::ticks_per_second >= system_time_point::subsecond_fraction ?
- fractional_seconds / conversion_ratio : fractional_seconds * conversion_ratio);
- }
-};
-
-} // namespace detail
-
-} // namespace sync
-
-} // namespace boost
-
-#include <boost/sync/detail/footer.hpp>
-
-#endif // BOOST_SYNC_SUPPORT_DATE_TIME_HPP_INCLUDED_
Added: trunk/boost/sync/support/posix_time.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/sync/support/posix_time.hpp 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013) (r85829)
@@ -0,0 +1,55 @@
+/*
+ * Copyright Andrey Semashev 2013.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file support/posix_time.hpp
+ *
+ * \brief This header enables support for POSIX time units.
+ */
+
+#ifndef BOOST_SYNC_SUPPORT_POSIX_TIME_HPP_INCLUDED_
+#define BOOST_SYNC_SUPPORT_POSIX_TIME_HPP_INCLUDED_
+
+#include <time.h>
+#include <boost/static_assert.hpp>
+#include <boost/sync/detail/config.hpp>
+#include <boost/sync/detail/time_traits.hpp>
+#include <boost/sync/detail/time_units.hpp>
+#include <boost/sync/detail/header.hpp>
+
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+namespace boost {
+
+namespace sync {
+
+namespace detail {
+
+template< >
+struct time_traits< struct ::timespec >
+{
+ typedef time_point_tag tag;
+
+ static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
+
+ static system_time_point to_sync_unit(struct ::timespec const& point)
+ {
+ BOOST_STATIC_ASSERT_MSG(system_time_point::subsecond_fraction == 1000000000u, "Boost.Sync: Unexpected system time point resolution");
+ return system_time_point(point.tv_sec, point.tv_nsec);
+ }
+};
+
+} // namespace detail
+
+} // namespace sync
+
+} // namespace boost
+
+#include <boost/sync/detail/footer.hpp>
+
+#endif // BOOST_SYNC_SUPPORT_POSIX_TIME_HPP_INCLUDED_
Added: trunk/boost/sync/support/std_chrono.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/boost/sync/support/std_chrono.hpp 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013) (r85829)
@@ -0,0 +1,88 @@
+/*
+ * Copyright Andrey Semashev 2013.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file support/std_chrono.hpp
+ *
+ * \brief This header enables support for std::chrono time units.
+ */
+
+#ifndef BOOST_SYNC_SUPPORT_STD_CHRONO_HPP_INCLUDED_
+#define BOOST_SYNC_SUPPORT_STD_CHRONO_HPP_INCLUDED_
+
+#include <ratio>
+#include <chrono>
+#include <boost/sync/detail/config.hpp>
+#include <boost/sync/detail/time_traits.hpp>
+#include <boost/sync/detail/time_units.hpp>
+#include <boost/sync/detail/header.hpp>
+
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+namespace boost {
+
+namespace sync {
+
+namespace detail {
+
+template< typename Rep, typename Period >
+struct time_traits< std::chrono::duration< Rep, Period > >
+{
+ typedef time_duration_tag tag;
+
+ static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
+
+ static system_duration to_sync_unit(std::chrono::duration< Rep, Period > const& dur) BOOST_NOEXCEPT
+ {
+ typedef std::chrono::duration< system_duration::native_type, std::ratio< 1, system_duration::subsecond_fraction > > system_chrono_duration;
+ return system_duration(std::chrono::duration_cast< system_chrono_duration >(dur).count());
+ }
+};
+
+template< typename Clock, typename Duration >
+struct time_traits< std::chrono::time_point< Clock, Duration > >
+{
+ typedef time_point_tag tag;
+
+ static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
+
+ static chrono_time_point< std::chrono::time_point< Clock, Duration > > to_sync_unit(std::chrono::time_point< Clock, Duration > const& point) BOOST_NOEXCEPT
+ {
+ return chrono_time_point< std::chrono::time_point< Clock, Duration > >(point);
+ }
+};
+
+template< typename Duration >
+struct time_traits< std::chrono::time_point< std::chrono::system_clock, Duration > >
+{
+ typedef time_point_tag tag;
+
+ static BOOST_CONSTEXPR_OR_CONST bool is_specialized = true;
+
+ static system_time_point to_sync_unit(std::chrono::time_point< std::chrono::system_clock, Duration > const& point) BOOST_NOEXCEPT
+ {
+ typedef std::chrono::time_point< std::chrono::system_clock, Duration > time_point;
+ typedef typename time_point::duration duration;
+ return system_time_point(time_traits< duration >::to_sync_unit(point.time_since_epoch()
+#if defined(BOOST_SYNC_DETAIL_STD_CHRONO_TIME_T_MISMATCH)
+ // Make sure system_clock times start at 1st January 1970
+ + std::chrono::seconds(std::chrono::system_clock::to_time_t(time_point()))
+#endif
+ ));
+ }
+};
+
+} // namespace detail
+
+} // namespace sync
+
+} // namespace boost
+
+#include <boost/sync/detail/footer.hpp>
+
+#endif // BOOST_SYNC_SUPPORT_STD_CHRONO_HPP_INCLUDED_
Added: trunk/libs/sync/test/run/chrono_system_clock_time_t_mismatch.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libs/sync/test/run/chrono_system_clock_time_t_mismatch.cpp 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013) (r85829)
@@ -0,0 +1,41 @@
+/*
+ * Copyright Andrey Semashev 2013.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file chrono_system_clock_time_t_mismatch.cpp
+ *
+ * \brief This test verifies that \c chrono::system_clock has the same epoch time point as \c std::time_t
+ */
+
+#include <boost/test/unit_test.hpp>
+
+#include <ctime>
+#include <boost/chrono/system_clocks.hpp>
+#include <boost/sync/detail/config.hpp>
+
+#if !defined(BOOST_NO_CXX11_HDR_CHRONO)
+#define BOOST_SYNC_DETAIL_TEST_STD_CHRONO
+#endif
+
+#if !defined(BOOST_SYNC_DETAIL_STD_CHRONO_TIME_T_MISMATCH)
+#define BOOST_SYNC_DETAIL_CHECK_CLOCK(x) BOOST_CHECK_EQUAL(x, (std::time_t)0)
+#else
+#define BOOST_SYNC_DETAIL_CHECK_CLOCK(x) BOOST_CHECK_NE(x, (std::time_t)0)
+#endif
+
+#if defined(BOOST_SYNC_DETAIL_TEST_STD_CHRONO)
+#include <chrono>
+
+BOOST_AUTO_TEST_CASE(std_chrono_system_clock_time_t_mismatch)
+{
+ BOOST_SYNC_DETAIL_CHECK_CLOCK(std::chrono::system_clock::to_time_t(std::chrono::system_clock::time_point()));
+}
+#endif
+
+BOOST_AUTO_TEST_CASE(boost_chrono_system_clock_time_t_mismatch)
+{
+ BOOST_CHECK_EQUAL(boost::chrono::system_clock::to_time_t(boost::chrono::system_clock::time_point()), (std::time_t)0);
+}
Modified: trunk/libs/sync/test/run/mutex_test.cpp
==============================================================================
--- trunk/libs/sync/test/run/mutex_test.cpp Sun Sep 22 08:23:26 2013 (r85828)
+++ trunk/libs/sync/test/run/mutex_test.cpp 2013-09-22 08:48:29 EDT (Sun, 22 Sep 2013) (r85829)
@@ -8,7 +8,7 @@
#include <boost/sync/mutexes.hpp>
#include <boost/sync/locks.hpp>
-#include <boost/sync/support/date_time.hpp>
+#include <boost/sync/support/boost_date_time.hpp>
//#include <boost/thread/recursive_mutex.hpp>
//#include <boost/thread/thread_time.hpp>
//#include <boost/thread/condition.hpp>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk