Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79553 - trunk/libs/interprocess/test
From: igaztanaga_at_[hidden]
Date: 2012-07-16 04:12:30


Author: igaztanaga
Date: 2012-07-16 04:12:29 EDT (Mon, 16 Jul 2012)
New Revision: 79553
URL: http://svn.boost.org/trac/boost/changeset/79553

Log:
Support Boost.Thread breaking change (TIME_UTC -> TIME_UTC_)
Text files modified:
   trunk/libs/interprocess/test/condition_test_template.hpp | 7 +++++++
   trunk/libs/interprocess/test/util.hpp | 5 +++++
   2 files changed, 12 insertions(+), 0 deletions(-)

Modified: trunk/libs/interprocess/test/condition_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/condition_test_template.hpp (original)
+++ trunk/libs/interprocess/test/condition_test_template.hpp 2012-07-16 04:12:29 EDT (Mon, 16 Jul 2012)
@@ -28,6 +28,7 @@
 #include <boost/thread/thread.hpp>
 #include <boost/date_time/posix_time/posix_time_types.hpp>
 #include <boost/thread/xtime.hpp>
+#include <boost/version.hpp>
 #include <iostream>
 
 namespace boost{
@@ -47,8 +48,14 @@
     const int NANOSECONDS_PER_MILLISECOND = 1000000;
 
     boost::xtime xt;
+
+ #if BOOST_VERSION >= 105100 //TIME_UTC is a macro in C11, breaking change in Boost.Thread
+ int ret = boost::xtime_get(&xt, boost::TIME_UTC_);
+ BOOST_INTERPROCES_CHECK(ret == static_cast<int>(boost::TIME_UTC_));(void)ret;
+ #else
     int ret = boost::xtime_get(&xt, boost::TIME_UTC);
     BOOST_INTERPROCES_CHECK(ret == static_cast<int>(boost::TIME_UTC));(void)ret;
+ #endif
     nsecs += xt.nsec;
     msecs += nsecs / NANOSECONDS_PER_MILLISECOND;
     secs += msecs / MILLISECONDS_PER_SECOND;

Modified: trunk/libs/interprocess/test/util.hpp
==============================================================================
--- trunk/libs/interprocess/test/util.hpp (original)
+++ trunk/libs/interprocess/test/util.hpp 2012-07-16 04:12:29 EDT (Mon, 16 Jul 2012)
@@ -30,6 +30,7 @@
 #include <boost/date_time/posix_time/posix_time_types.hpp>
 #include <algorithm>
 #include <iostream>
+#include <boost/version.hpp>
 
 namespace boost {
 namespace interprocess {
@@ -63,7 +64,11 @@
 boost::xtime xsecs(int secs)
 {
    boost::xtime ret;
+ #if BOOST_VERSION >= 105100 //TIME_UTC is a macro in C11, breaking change in Boost.Thread
+ boost::xtime_get(&ret, boost::TIME_UTC_);
+ #else
    boost::xtime_get(&ret, boost::TIME_UTC);
+ #endif
    ret.sec += secs;
    return ret;
 }


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