static time_rep_type add_time_duration(const time_rep_type& base, time_duration_type td) { if(base.day.is_special() || td.is_special()) { return split_timedate_system::get_time_rep(base.day, td); } if (td.is_negative()) { time_duration_type td1 = td.invert_sign(); return subtract_time_duration(base,td1); } wrap_int_type day_offset(base.time_of_day.ticks()); date_duration_type day_overflow(static_cast< typename date_duration_type::duration_rep_type >(day_offset.add(td.ticks()))); return time_rep_type(base.day+day_overflow, time_duration_type(0,0,0,day_offset.as_int())); }
static time_rep_type add_time_duration(const time_rep_type& base, time_duration_type td) { if(base.day.is_special() || td.is_special()) { return split_timedate_system::get_time_rep(base.day, td); } if (td.is_negative()) { time_duration_type td1 = td.invert_sign(); return subtract_time_duration(base,td1); } wrap_int_type day_offset(base.time_of_day.ticks()); int_type doff = day_offset.add(td.ticks()); // std::cout << "day overflow: " << doff << std::endl; // std::cout << "ticks: " << td.ticks() << std::endl; date_duration_type day_overflow(static_cast<int_type>(doff)); // std::cout << "base: " << to_simple_string(base.day) << std::endl; // std::cout << "overflow " << day_overflow.days() << std::endl; return time_rep_type(base.day+day_overflow, time_duration_type(0,0,0,day_offset.as_int())); }