diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-02-11 12:14:00 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-02-11 12:14:00 (GMT) |
commit | 0efa7c32aaf21a29b42b5926cc116007056843be (patch) | |
tree | 882f663a5dd0e65694bf6077b71086dd77fd7ff8 /3rdParty/Boost/boost/date_time/time_resolution_traits.hpp | |
parent | 1d20eabbc32274b491b4c2bedf73d19933d97bfd (diff) | |
download | swift-contrib-0efa7c32aaf21a29b42b5926cc116007056843be.zip swift-contrib-0efa7c32aaf21a29b42b5926cc116007056843be.tar.bz2 |
Moved some modules into separate git modules.
Diffstat (limited to '3rdParty/Boost/boost/date_time/time_resolution_traits.hpp')
m--------- | 3rdParty/Boost | 0 | ||||
-rw-r--r-- | 3rdParty/Boost/boost/date_time/time_resolution_traits.hpp | 140 |
2 files changed, 0 insertions, 140 deletions
diff --git a/3rdParty/Boost b/3rdParty/Boost new file mode 160000 +Subproject 3bbdbc8cf1996f23d9a366da8bac0f97be6ad79 diff --git a/3rdParty/Boost/boost/date_time/time_resolution_traits.hpp b/3rdParty/Boost/boost/date_time/time_resolution_traits.hpp deleted file mode 100644 index 1487911..0000000 --- a/3rdParty/Boost/boost/date_time/time_resolution_traits.hpp +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef DATE_TIME_TIME_RESOLUTION_TRAITS_HPP -#define DATE_TIME_TIME_RESOLUTION_TRAITS_HPP - -/* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * 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) $ - */ - - -#include "boost/date_time/time_defs.hpp" -#include "boost/date_time/int_adapter.hpp" -#include "boost/cstdint.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], - // moved here from time_duration.hpp 2003-Sept-4. - inline T absolute_value(T x) - { - return x < 0 ? -x : x; - } - - //! traits struct for time_resolution_traits implementation type - struct time_resolution_traits_bi32_impl { - typedef boost::int32_t int_type; - typedef boost::int32_t impl_type; - static int_type as_number(impl_type i){ return i;} - //! Used to determine if implemented type is int_adapter or int - static bool is_adapted() { return false;} - }; - //! traits struct for time_resolution_traits implementation type - struct time_resolution_traits_adapted32_impl { - typedef boost::int32_t int_type; - typedef boost::date_time::int_adapter<boost::int32_t> impl_type; - static int_type as_number(impl_type i){ return i.as_number();} - //! Used to determine if implemented type is int_adapter or int - static bool is_adapted() { return true;} - }; - //! traits struct for time_resolution_traits implementation type - struct time_resolution_traits_bi64_impl { - typedef boost::int64_t int_type; - typedef boost::int64_t impl_type; - static int_type as_number(impl_type i){ return i;} - //! Used to determine if implemented type is int_adapter or int - static bool is_adapted() { return false;} - }; - //! traits struct for time_resolution_traits implementation type - struct time_resolution_traits_adapted64_impl { - typedef boost::int64_t int_type; - typedef boost::date_time::int_adapter<boost::int64_t> impl_type; - static int_type as_number(impl_type i){ return i.as_number();} - //! Used to determine if implemented type is int_adapter or int - static bool is_adapted() { return true;} - }; - - template<typename frac_sec_type, - time_resolutions res, -#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) - boost::int64_t resolution_adjust, -#else - typename frac_sec_type::int_type resolution_adjust, -#endif - 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; - typedef typename frac_sec_type::int_type tick_type; - typedef typename frac_sec_type::impl_type impl_type; - typedef v_type day_type; - 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) - { - return frac_sec_type::as_number(i); - } - static bool is_adapted() - { - 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; - - static time_resolutions resolution() - { - return res; - } - static unsigned short num_fractional_digits() - { - return frac_digits; - } - static fractional_seconds_type res_adjust() - { - return resolution_adjust; - } - //! Any negative argument results in a negative tick_count - static tick_type to_tick_count(hour_type hours, - min_type minutes, - sec_type seconds, - fractional_seconds_type fs) - { - if(hours < 0 || minutes < 0 || seconds < 0 || fs < 0) - { - hours = absolute_value(hours); - minutes = absolute_value(minutes); - seconds = absolute_value(seconds); - fs = absolute_value(fs); - 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) - + seconds)*res_adjust()) + fs; - } - - }; - - typedef time_resolution_traits<time_resolution_traits_adapted32_impl, milli, 1000, 3 > milli_res; - typedef time_resolution_traits<time_resolution_traits_adapted64_impl, micro, 1000000, 6 > micro_res; - typedef time_resolution_traits<time_resolution_traits_adapted64_impl, nano, 1000000000, 9 > nano_res; - - -} } //namespace date_time - - - -#endif |