diff --git a/include/boost/date_time/adjust_functors.hpp b/include/boost/date_time/adjust_functors.hpp index 0e94a89..dbebf02 100644 --- a/include/boost/date_time/adjust_functors.hpp +++ b/include/boost/date_time/adjust_functors.hpp @@ -151,9 +151,6 @@ namespace date_time { }; //! Functor to iterate by a year adjusting for leap years - /*! - *@throws bad_day if date value is invalid (eg: feb 29) - */ template class year_functor { @@ -163,20 +160,17 @@ namespace date_time { year_functor(int f) : f_(f) {} duration_type get_offset(const date_type& d) const { - year_type y = static_cast(d.year()+f_); - date_type new_date(y, d.month(), d.day()); - return new_date-d; + month_functor mf(f_ * 12); + return mf.get_offset(d); } duration_type get_neg_offset(const date_type& d) const { - year_type y = static_cast(d.year()-f_); - date_type new_date(y, d.month(), d.day()); - return new_date-d; + month_functor mf(f_ * 12); + return mf.get_neg_offset(d); } private: int f_; }; - } }//namespace date_time