summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2012-07-09 18:11:54 -0400
committerMathias Stearn <mathias@10gen.com>2012-07-10 17:56:28 -0400
commitb113287f27810722b09fee13d66d4ca307872d96 (patch)
treedc377ef90f2ad1e348651c7b8e282bb4f7a406e5
parent5dcd31a8f12ab35bfbcd32d59e27065a676264f0 (diff)
downloadmongo-b113287f27810722b09fee13d66d4ca307872d96.tar.gz
SERVER-6340 Use TIME_UTC_ rather than TIME_UTC
This avoids a compilation failure with glibc-2.16 or any other C11 libc. Boost made the same change for boost-1.50: https://svn.boost.org/trac/boost/ticket/6940
-rw-r--r--src/mongo/db/repl_block.cpp2
-rw-r--r--src/mongo/util/background.cpp2
-rw-r--r--src/mongo/util/concurrency/mutex.h2
-rw-r--r--src/mongo/util/queue.h4
-rw-r--r--src/mongo/util/time_support.cpp16
-rw-r--r--src/third_party/boost/boost/thread/xtime.hpp5
-rw-r--r--src/third_party/boost/libs/thread/src/pthread/thread.cpp4
-rw-r--r--src/third_party/boost/libs/thread/src/pthread/timeconv.inl16
-rw-r--r--src/third_party/boost/libs/thread/src/win32/timeconv.inl16
9 files changed, 34 insertions, 33 deletions
diff --git a/src/mongo/db/repl_block.cpp b/src/mongo/db/repl_block.cpp
index 9de566ac875..f78af4d1724 100644
--- a/src/mongo/db/repl_block.cpp
+++ b/src/mongo/db/repl_block.cpp
@@ -183,7 +183,7 @@ namespace mongo {
w--; // now this is the # of slaves i need
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += maxSecondsToWait;
scoped_lock mylk(_mutex);
diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp
index 5aee43eeadd..5ae9c441213 100644
--- a/src/mongo/util/background.cpp
+++ b/src/mongo/util/background.cpp
@@ -92,7 +92,7 @@ namespace mongo {
if ( msTimeOut ) {
// add msTimeOut millisecond to current time
boost::xtime xt;
- boost::xtime_get( &xt, boost::TIME_UTC );
+ boost::xtime_get( &xt, boost::TIME_UTC_ );
unsigned long long ns = msTimeOut * 1000000ULL; // milli to nano
if ( xt.nsec + ns < 1000000000 ) {
diff --git a/src/mongo/util/concurrency/mutex.h b/src/mongo/util/concurrency/mutex.h
index 7ea7f6204ac..acbc3983710 100644
--- a/src/mongo/util/concurrency/mutex.h
+++ b/src/mongo/util/concurrency/mutex.h
@@ -37,7 +37,7 @@ namespace mongo {
inline boost::xtime incxtimemillis( long long s ) {
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += (int)( s / 1000 );
xt.nsec += (int)(( s % 1000 ) * 1000000);
if ( xt.nsec >= 1000000000 ) {
diff --git a/src/mongo/util/queue.h b/src/mongo/util/queue.h
index c5a363cae87..581eb722e61 100644
--- a/src/mongo/util/queue.h
+++ b/src/mongo/util/queue.h
@@ -121,7 +121,7 @@ namespace mongo {
Timer timer;
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += maxSecondsToWait;
scoped_lock l( _lock );
@@ -143,7 +143,7 @@ namespace mongo {
Timer timer;
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += maxSecondsToWait;
scoped_lock l( _lock );
diff --git a/src/mongo/util/time_support.cpp b/src/mongo/util/time_support.cpp
index 5732c8157c9..7391ea1fe94 100644
--- a/src/mongo/util/time_support.cpp
+++ b/src/mongo/util/time_support.cpp
@@ -106,7 +106,7 @@ namespace mongo {
if ( s <= 0 )
return;
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += (int)( s / 1000000 );
xt.nsec += (int)(( s % 1000000 ) * 1000);
if ( xt.nsec >= 1000000000 ) {
@@ -118,13 +118,13 @@ namespace mongo {
#elif defined(__sunos__)
void sleepsecs(int s) {
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += s;
boost::thread::sleep(xt);
}
void sleepmillis(long long s) {
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += (int)( s / 1000 );
xt.nsec += (int)(( s % 1000 ) * 1000000);
if ( xt.nsec >= 1000000000 ) {
@@ -137,7 +137,7 @@ namespace mongo {
if ( s <= 0 )
return;
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
xt.sec += (int)( s / 1000000 );
xt.nsec += (int)(( s % 1000000 ) * 1000);
if ( xt.nsec >= 1000000000 ) {
@@ -202,24 +202,24 @@ namespace mongo {
#ifdef _WIN32 // no gettimeofday on windows
unsigned long long curTimeMillis64() {
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
return ((unsigned long long)xt.sec) * 1000 + xt.nsec / 1000000;
}
Date_t jsTime() {
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
unsigned long long t = xt.nsec / 1000000;
return ((unsigned long long) xt.sec * 1000) + t + getJSTimeVirtualSkew() + getJSTimeVirtualThreadSkew();
}
unsigned long long curTimeMicros64() {
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
unsigned long long t = xt.nsec / 1000;
return (((unsigned long long) xt.sec) * 1000000) + t;
}
unsigned curTimeMicros() {
boost::xtime xt;
- boost::xtime_get(&xt, boost::TIME_UTC);
+ boost::xtime_get(&xt, boost::TIME_UTC_);
unsigned t = xt.nsec / 1000;
unsigned secs = xt.sec % 1024;
return secs*1000000 + t;
diff --git a/src/third_party/boost/boost/thread/xtime.hpp b/src/third_party/boost/boost/thread/xtime.hpp
index 7cc6272d6a6..d0dec24cba3 100644
--- a/src/third_party/boost/boost/thread/xtime.hpp
+++ b/src/third_party/boost/boost/thread/xtime.hpp
@@ -20,7 +20,8 @@ namespace boost {
enum xtime_clock_types
{
- TIME_UTC=1
+ //TIME_UTC=1
+ TIME_UTC_=1 // 10gen: switched to TIME_UTC_ as in boost 1.50 to avoid C11 / glibc-2.16 conflict
// TIME_TAI,
// TIME_MONOTONIC,
// TIME_PROCESS,
@@ -68,7 +69,7 @@ inline xtime get_xtime(boost::system_time const& abs_time)
inline int xtime_get(struct xtime* xtp, int clock_type)
{
- if (clock_type == TIME_UTC)
+ if (clock_type == TIME_UTC_)
{
*xtp=get_xtime(get_system_time());
return clock_type;
diff --git a/src/third_party/boost/libs/thread/src/pthread/thread.cpp b/src/third_party/boost/libs/thread/src/pthread/thread.cpp
index 07b8458bce8..847662b90f4 100644
--- a/src/third_party/boost/libs/thread/src/pthread/thread.cpp
+++ b/src/third_party/boost/libs/thread/src/pthread/thread.cpp
@@ -354,7 +354,7 @@ namespace boost
cond.timed_wait(lock, xt);
# endif
xtime cur;
- xtime_get(&cur, TIME_UTC);
+ xtime_get(&cur, TIME_UTC_);
if (xtime_cmp(xt, cur) <= 0)
return;
}
@@ -369,7 +369,7 @@ namespace boost
BOOST_VERIFY(!pthread_yield());
# else
xtime xt;
- xtime_get(&xt, TIME_UTC);
+ xtime_get(&xt, TIME_UTC_);
sleep(xt);
# endif
}
diff --git a/src/third_party/boost/libs/thread/src/pthread/timeconv.inl b/src/third_party/boost/libs/thread/src/pthread/timeconv.inl
index 1c0a0cdca80..cab7c55a783 100644
--- a/src/third_party/boost/libs/thread/src/pthread/timeconv.inl
+++ b/src/third_party/boost/libs/thread/src/pthread/timeconv.inl
@@ -20,8 +20,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000;
inline void to_time(int milliseconds, boost::xtime& xt)
{
int res = 0;
- res = boost::xtime_get(&xt, boost::TIME_UTC);
- BOOST_ASSERT(res == boost::TIME_UTC); (void)res;
+ res = boost::xtime_get(&xt, boost::TIME_UTC_);
+ BOOST_ASSERT(res == boost::TIME_UTC_); (void)res;
xt.sec += (milliseconds / MILLISECONDS_PER_SECOND);
xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) *
@@ -56,8 +56,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts)
{
boost::xtime cur;
int res = 0;
- res = boost::xtime_get(&cur, boost::TIME_UTC);
- BOOST_ASSERT(res == boost::TIME_UTC); (void)res;
+ res = boost::xtime_get(&cur, boost::TIME_UTC_);
+ BOOST_ASSERT(res == boost::TIME_UTC_); (void)res;
if (boost::xtime_cmp(xt, cur) <= 0)
{
@@ -87,8 +87,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds)
{
boost::xtime cur;
int res = 0;
- res = boost::xtime_get(&cur, boost::TIME_UTC);
- BOOST_ASSERT(res == boost::TIME_UTC); (void)res;
+ res = boost::xtime_get(&cur, boost::TIME_UTC_);
+ BOOST_ASSERT(res == boost::TIME_UTC_); (void)res;
if (boost::xtime_cmp(xt, cur) <= 0)
milliseconds = 0;
@@ -109,8 +109,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds)
{
boost::xtime cur;
int res = 0;
- res = boost::xtime_get(&cur, boost::TIME_UTC);
- BOOST_ASSERT(res == boost::TIME_UTC); (void)res;
+ res = boost::xtime_get(&cur, boost::TIME_UTC_);
+ BOOST_ASSERT(res == boost::TIME_UTC_); (void)res;
if (boost::xtime_cmp(xt, cur) <= 0)
microseconds = 0;
diff --git a/src/third_party/boost/libs/thread/src/win32/timeconv.inl b/src/third_party/boost/libs/thread/src/win32/timeconv.inl
index 5ec3b1798a4..c6467832a7e 100644
--- a/src/third_party/boost/libs/thread/src/win32/timeconv.inl
+++ b/src/third_party/boost/libs/thread/src/win32/timeconv.inl
@@ -17,8 +17,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000;
inline void to_time(int milliseconds, boost::xtime& xt)
{
int res = 0;
- res = boost::xtime_get(&xt, boost::TIME_UTC);
- assert(res == boost::TIME_UTC);
+ res = boost::xtime_get(&xt, boost::TIME_UTC_);
+ assert(res == boost::TIME_UTC_);
xt.sec += (milliseconds / MILLISECONDS_PER_SECOND);
xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) *
@@ -54,8 +54,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts)
{
boost::xtime cur;
int res = 0;
- res = boost::xtime_get(&cur, boost::TIME_UTC);
- assert(res == boost::TIME_UTC);
+ res = boost::xtime_get(&cur, boost::TIME_UTC_);
+ assert(res == boost::TIME_UTC_);
if (boost::xtime_cmp(xt, cur) <= 0)
{
@@ -85,8 +85,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds)
{
boost::xtime cur;
int res = 0;
- res = boost::xtime_get(&cur, boost::TIME_UTC);
- assert(res == boost::TIME_UTC);
+ res = boost::xtime_get(&cur, boost::TIME_UTC_);
+ assert(res == boost::TIME_UTC_);
if (boost::xtime_cmp(xt, cur) <= 0)
milliseconds = 0;
@@ -107,8 +107,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds)
{
boost::xtime cur;
int res = 0;
- res = boost::xtime_get(&cur, boost::TIME_UTC);
- assert(res == boost::TIME_UTC);
+ res = boost::xtime_get(&cur, boost::TIME_UTC_);
+ assert(res == boost::TIME_UTC_);
if (boost::xtime_cmp(xt, cur) <= 0)
microseconds = 0;