diff --git a/include/boost/thread/xtime.hpp b/include/boost/thread/xtime.hpp index 163d075f..e69d2d5e 100644 --- a/include/boost/thread/xtime.hpp +++ b/include/boost/thread/xtime.hpp @@ -33,26 +33,23 @@ enum xtime_clock_types struct xtime { #if defined(BOOST_NO_INT64_T) - int_fast32_t sec; + int_fast32_t sec; //INT_FAST32_MIN <= sec <= INT_FAST32_MAX #else - int_fast64_t sec; + int_fast64_t sec; //INT_FAST64_MIN <= sec <= INT_FAST64_MAX #endif - int_fast32_t nsec; + int_fast32_t nsec; //0 <= xtime.nsec < NANOSECONDS_PER_SECOND }; int BOOST_THREAD_DECL xtime_get(struct xtime* xtp, int clock_type); + inline int xtime_cmp(const xtime& xt1, const xtime& xt2) { - int res = (int)(xt1.sec - xt2.sec); - if (res == 0) - res = (int)(xt1.nsec - xt2.nsec); - return res; + if (xt1.sec == xt2.sec) + return (int)(xt1.nsec - xt2.nsec); + else + return (xt1.sec > xt2.sec) ? 1 : -1; } } // namespace boost -// Change Log: -// 8 Feb 01 WEKEMPF Initial version. - -#endif // BOOST_XTIME_WEK070601_HPP - +#endif //BOOST_XTIME_WEK070601_HPP