*** /home/rocko/tmp/boost_changes/date_duration_operators.hpp Tue Mar 30 19:12:34 2010 --- date_duration_operators.hpp Thu Apr 1 17:43:59 2010 *************** *** 5,11 **** * 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) $ */ --- 5,11 ---- * 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, Adam Preble * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ */ *************** *** 23,28 **** --- 23,66 ---- */ + // ptime & days + + /*! Adds a days object and a ptime. Result will be same time of day. */ + inline + ptime + operator+(const ptime& t, const boost::gregorian::days& d) + { + return ptime(t.date() + d, t.time_of_day()); + } + + /*! Adds a days object to a ptime. Result will be same time of day. */ + inline + ptime + operator+=(ptime& t, const boost::gregorian::days& d) + { + t = ptime(t.date() + d, t.time_of_day()); + return t; + } + + /*! Subtracts a days object and a ptime. Result will be same time of day. */ + inline + ptime + operator-(const ptime& t, const boost::gregorian::days& d) + { + return ptime(t.date() - d, t.time_of_day()); + } + + /*! Subtracts a days object from a ptime. Result will be same time of day. */ + inline + ptime + operator-=(ptime& t, const boost::gregorian::days& d) + { + t = ptime(t.date() - d, t.time_of_day()); + return t; + } + + // ptime & months + /*! Adds a months object and a ptime. Result will be same * day-of-month as ptime unless original day was the last day of month. * see date_time::months_duration for more details */