//============================================================================================ // Create a new DataTime forward elapsed from given data //============================================================================================ DateTime TimeComparer::DetermineBackwardsElapsed(const DateTime& dt, const PeriodData& pd) { PartialDateTime isoDt(dt, CalType::CalType_ISO); //add time Time tm; FixedDateTime fwdDate = isoDt.GetFixed() - tm.ConvertToFixed(HMS(pd.elapsedHours, pd.elapsedMinutes, pd.elapsedSeconds, pd.elapsedMilliseconds)); return DateTime(fwdDate); }
//======================================================================================== // Create a new DataTime forward elapsed from given data //========================================================================================= DateTime YearWeekDayTimeComparer::DetermineForwardElapsed(const DateTime& dt, const PeriodData& pd) { PartialDateTime isoDt(dt, CalType::CalType_ISO); int year = isoDt.GetYear() + pd.elapsedYears; PartialDateTime pDt(year, 1, 1, CalType::CalType_ISO); FixedDateTime fwdDate = calmath::ExtractDate(pDt.GetFixed()) + (pd.elapsedWeeks * 7) + pd.elapsedDays - 1; //add time Time tm; fwdDate += (tm.ExtractTime(dt.GetFixed()) + tm.ConvertToFixed(HMS(pd.elapsedHours, pd.elapsedMinutes, pd.elapsedSeconds, pd.elapsedMilliseconds))); return DateTime(fwdDate); }