summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl')
-rw-r--r--3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl21
1 files changed, 20 insertions, 1 deletions
diff --git a/3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl b/3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl
index cab7c55..d81f31b 100644
--- a/3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl
+++ b/3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl
@@ -17,6 +17,7 @@ const int NANOSECONDS_PER_MILLISECOND = 1000000;
const int MICROSECONDS_PER_SECOND = 1000000;
const int NANOSECONDS_PER_MICROSECOND = 1000;
+#if defined BOOST_THREAD_USES_DATETIME
inline void to_time(int milliseconds, boost::xtime& xt)
{
int res = 0;
@@ -33,7 +34,9 @@ inline void to_time(int milliseconds, boost::xtime& xt)
xt.nsec -= NANOSECONDS_PER_SECOND;
}
}
+#endif
#if defined(BOOST_HAS_PTHREADS)
+#if defined BOOST_THREAD_USES_DATETIME
inline void to_timespec(const boost::xtime& xt, timespec& ts)
{
ts.tv_sec = static_cast<int>(xt.sec);
@@ -44,14 +47,27 @@ inline void to_timespec(const boost::xtime& xt, timespec& ts)
ts.tv_nsec %= NANOSECONDS_PER_SECOND;
}
}
-
+#endif
inline void to_time(int milliseconds, timespec& ts)
{
+#if defined BOOST_THREAD_USES_DATETIME
boost::xtime xt;
to_time(milliseconds, xt);
to_timespec(xt, ts);
+#else
+ ts.tv_sec += (milliseconds / MILLISECONDS_PER_SECOND);
+ ts.tv_nsec += ((milliseconds % MILLISECONDS_PER_SECOND) *
+ NANOSECONDS_PER_MILLISECOND);
+
+ if (ts.tv_nsec >= NANOSECONDS_PER_SECOND)
+ {
+ ++ts.tv_sec;
+ ts.tv_nsec -= NANOSECONDS_PER_SECOND;
+ }
+#endif
}
+#if defined BOOST_THREAD_USES_DATETIME
inline void to_timespec_duration(const boost::xtime& xt, timespec& ts)
{
boost::xtime cur;
@@ -82,7 +98,9 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts)
}
}
#endif
+#endif
+#if defined BOOST_THREAD_USES_DATETIME
inline void to_duration(boost::xtime xt, int& milliseconds)
{
boost::xtime cur;
@@ -126,6 +144,7 @@ inline void to_microduration(boost::xtime xt, int& microseconds)
NANOSECONDS_PER_MICROSECOND);
}
}
+#endif
}
// Change Log: