diff options
Diffstat (limited to 'boost/date_time/time_duration.hpp')
-rw-r--r-- | boost/date_time/time_duration.hpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/boost/date_time/time_duration.hpp b/boost/date_time/time_duration.hpp index fe4881e88b..67930cf8d3 100644 --- a/boost/date_time/time_duration.hpp +++ b/boost/date_time/time_duration.hpp @@ -9,12 +9,14 @@ * $Date$ */ +#include <boost/core/enable_if.hpp> #include <boost/cstdint.hpp> +#include <boost/date_time/compiler_config.hpp> +#include <boost/date_time/special_defs.hpp> +#include <boost/date_time/time_defs.hpp> #include <boost/operators.hpp> #include <boost/static_assert.hpp> -#include <boost/date_time/time_defs.hpp> -#include <boost/date_time/special_defs.hpp> -#include <boost/date_time/compiler_config.hpp> +#include <boost/type_traits/is_integral.hpp> namespace boost { namespace date_time { @@ -262,7 +264,7 @@ namespace date_time { //! Template for instantiating derived adjusting durations /* These templates are designed to work with multiples of - * 10 for frac_of_second and resoultion adjustment + * 10 for frac_of_second and resolution adjustment */ template<class base_duration, boost::int64_t frac_of_second> class BOOST_SYMBOL_VISIBLE subsecond_duration : public base_duration @@ -278,14 +280,15 @@ namespace date_time { BOOST_STATIC_CONSTANT(boost::int64_t, adjustment_ratio = (traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second / frac_of_second : frac_of_second / traits_type::ticks_per_second)); public: - explicit subsecond_duration(boost::int64_t ss) : + // The argument (ss) must be an integral type + template <typename T> + explicit subsecond_duration(T const& ss, + typename boost::enable_if<boost::is_integral<T>, void>::type* = 0) : base_duration(impl_type(traits_type::ticks_per_second >= frac_of_second ? ss * adjustment_ratio : ss / adjustment_ratio)) { } }; - - } } //namespace date_time |