public PeriodValue plus(PeriodValue period) { double seconds = (double)(this.Seconds + period.Seconds) + (((double)(this.Millis + period.Millis)) / 1000.0); double millis_d = Math.Round(seconds * 1000, 0); int millis = Math.Abs((int)millis_d % 1000); return(new PeriodValue( this.Years + period.Years, this.Months + period.Months, this.Weeks + period.Weeks, this.Days + period.Days, this.Hours + period.Hours, this.Minutes + period.Minutes, (int)seconds, millis)); }
public override bool Equals(object obj) { if (obj is PeriodValue) { PeriodValue period = (PeriodValue)obj; return(this.Years == period.Years && this.Months == period.Months && this.Weeks == period.Weeks && this.Days == period.Days && this.Hours == period.Hours && this.Minutes == period.Minutes && this.Seconds == period.Seconds && this.Millis == period.Millis); } else { return(false); } }
internal DateTimeValue plus(PeriodValue period) { return(new DateTimeValue(this.value.AddYears(period.Years).AddMonths(period.Months).AddDays(period.Weeks * 7).AddDays(period.Days) .AddHours(period.Hours).AddMinutes(period.Minutes).AddSeconds(period.Seconds).AddMilliseconds(period.Millis))); }
internal DateValue plus(PeriodValue period) { return(new DateValue(this.value.AddYears(period.Years).AddMonths(period.Months).AddDays(period.Weeks * 7).AddDays(period.Days))); }
public DateValue minus(PeriodValue period) { return(new DateValue(this.value.AddYears(-period.Years).AddMonths(-period.Months).AddDays(-period.Weeks * 7).AddDays(-period.Days))); }
internal TimeValue plus(PeriodValue period) { TimeSpan p = new TimeSpan(0, period.Hours, period.Minutes, period.Seconds, period.Millis); return(new TimeValue(value.Add(p))); }
public TimeValue minus(PeriodValue period) { TimeSpan p = new TimeSpan(0, period.Hours, period.Minutes, period.Seconds, period.Millis); return(new TimeValue(value.Subtract(p))); }