/// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of months away from the specified <see cref="T:System.DateTime" />.</summary>
/// <param name="time">The <see cref="T:System.DateTime" /> to which to add months. </param>
/// <param name="months">The number of months to add. </param>
/// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of months to the specified <see cref="T:System.DateTime" />.</returns>
/// <exception cref="T:System.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="months" /> is less than -120000.-or-
/// <paramref name="months" /> is greater than 120000. </exception>
// Token: 0x06002F49 RID: 12105 RVA: 0x000B53F8 File Offset: 0x000B35F8
public override DateTime AddMonths(DateTime time, int months)
{
if (months < -120000 || months > 120000)
{
throw new ArgumentOutOfRangeException("months", string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), -120000, 120000));
}
int num = JulianCalendar.GetDatePart(time.Ticks, 0);
int num2 = JulianCalendar.GetDatePart(time.Ticks, 2);
int num3 = JulianCalendar.GetDatePart(time.Ticks, 3);
int num4 = num2 - 1 + months;
if (num4 >= 0)
{
num2 = num4 % 12 + 1;
num += num4 / 12;
}
else
{
num2 = 12 + (num4 + 1) % 12;
num += (num4 - 11) / 12;
}
int[] array = (num % 4 == 0 && (num % 100 != 0 || num % 400 == 0)) ? JulianCalendar.DaysToMonth366 : JulianCalendar.DaysToMonth365;
int num5 = array[num2] - array[num2 - 1];
if (num3 > num5)
{
num3 = num5;
}
long ticks = JulianCalendar.DateToTicks(num, num2, num3) + time.Ticks % 864000000000L;
Calendar.CheckAddResult(ticks, this.MinSupportedDateTime, this.MaxSupportedDateTime);
return(new DateTime(ticks));
}