Philipp
Philipp

Reputation: 11833

boost::TIME_UTC(_) with different boost versions

I just upgraded my project on Windows from boost 1.46 to the current boost 1.52. We have some usages of boost::TIME_UTC which I changed to boost::TIME_UTC_ according to https://svn.boost.org/trac/boost/ticket/6940.

However, we also build the source on some linux machines with boost 1.49 which doesn't know the boost::TIME_UTC_. Is there any suggested way to use boost 1.49 and 1.52 in parallel with TIME_UTC?

Upvotes: 7

Views: 7144

Answers (2)

abergmeier
abergmeier

Reputation: 14071

We use:

#include <boost/version.hpp>
#if BOOST_VERSION < 105000
#include <boost/thread/xtime.hpp>
namespace boost {
  enum xtime_compat {
    TIME_UTC_=TIME_UTC
  };
}
#endif

This way you can use boost::TIME_UTC_, as in 1.50 onwards.

But not for openSuse, because they decided to merge this change back to 1.49.

Upvotes: 2

David Schwartz
David Schwartz

Reputation: 182875

Change everything to TIME_UTC_. Then use this:

#include <boost/version.hpp>
#if BOOST_VERSION < 105000
#define TIME_UTC_ TIME_UTC
#endif

Upvotes: 11

Related Questions