summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp')
-rw-r--r--3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp54
1 files changed, 29 insertions, 25 deletions
diff --git a/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp b/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp
index 1487911..658f3d2 100644
--- a/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp
+++ b/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp
@@ -2,26 +2,27 @@
#define DATE_TIME_TIME_RESOLUTION_TRAITS_HPP
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the
+ * Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2009-06-06 07:25:55 -0400 (Sat, 06 Jun 2009) $
*/
-#include "boost/date_time/time_defs.hpp"
-#include "boost/date_time/int_adapter.hpp"
-#include "boost/cstdint.hpp"
+#include <boost/cstdint.hpp>
+#include <boost/date_time/time_defs.hpp>
+#include <boost/date_time/int_adapter.hpp>
+#include <boost/date_time/compiler_config.hpp>
namespace boost {
namespace date_time {
//! Simple function to calculate absolute value of a numeric type
- template <typename T>
- // JDG [7/6/02 made a template],
+ template <typename T>
+ // JDG [7/6/02 made a template],
// moved here from time_duration.hpp 2003-Sept-4.
- inline T absolute_value(T x)
+ inline T absolute_value(T x)
{
return x < 0 ? -x : x;
}
@@ -58,16 +59,16 @@ namespace date_time {
//! Used to determine if implemented type is int_adapter or int
static bool is_adapted() { return true;}
};
-
- template<typename frac_sec_type,
+
+ template<typename frac_sec_type,
time_resolutions res,
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
- boost::int64_t resolution_adjust,
+ boost::int64_t resolution_adjust,
#else
- typename frac_sec_type::int_type resolution_adjust,
+ typename frac_sec_type::int_type resolution_adjust,
#endif
- unsigned short frac_digits,
- typename v_type = boost::int32_t >
+ unsigned short frac_digits,
+ typename v_type = boost::int32_t >
class time_resolution_traits {
public:
typedef typename frac_sec_type::int_type fractional_seconds_type;
@@ -77,9 +78,9 @@ namespace date_time {
typedef v_type hour_type;
typedef v_type min_type;
typedef v_type sec_type;
-
+
// bring in function from frac_sec_type traits structs
- static typename frac_sec_type::int_type as_number(typename frac_sec_type::impl_type i)
+ static fractional_seconds_type as_number(impl_type i)
{
return frac_sec_type::as_number(i);
}
@@ -87,11 +88,14 @@ namespace date_time {
{
return frac_sec_type::is_adapted();
}
-
+
//Would like this to be frac_sec_type, but some compilers complain
- BOOST_STATIC_CONSTANT(int, ticks_per_second = resolution_adjust);
- // static const boost::int32_t ticks_per_second = resolution_adjust;
-
+#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
+ BOOST_STATIC_CONSTANT(boost::int64_t, ticks_per_second = resolution_adjust);
+#else
+ BOOST_STATIC_CONSTANT(fractional_seconds_type, ticks_per_second = resolution_adjust);
+#endif
+
static time_resolutions resolution()
{
return res;
@@ -116,16 +120,16 @@ namespace date_time {
minutes = absolute_value(minutes);
seconds = absolute_value(seconds);
fs = absolute_value(fs);
- return (((((fractional_seconds_type(hours)*3600)
- + (fractional_seconds_type(minutes)*60)
+ return (((((fractional_seconds_type(hours)*3600)
+ + (fractional_seconds_type(minutes)*60)
+ seconds)*res_adjust()) + fs) * -1);
}
- return (((fractional_seconds_type(hours)*3600)
- + (fractional_seconds_type(minutes)*60)
+ return (((fractional_seconds_type(hours)*3600)
+ + (fractional_seconds_type(minutes)*60)
+ seconds)*res_adjust()) + fs;
}
-
+
};
typedef time_resolution_traits<time_resolution_traits_adapted32_impl, milli, 1000, 3 > milli_res;