CheckTicksRange() private method

private CheckTicksRange ( long ticks ) : void
ticks long
return void
コード例 #1
0
        // Token: 0x06002F7C RID: 12156 RVA: 0x000B5B8C File Offset: 0x000B3D8C
        internal int GetDatePart(long ticks, int part)
        {
            PersianCalendar.CheckTicksRange(ticks);
            long num  = ticks / 864000000000L + 1L;
            long num2 = CalendricalCalculationsHelper.PersianNewYearOnOrBefore(num);
            int  num3 = (int)Math.Floor((double)(num2 - PersianCalendar.PersianEpoch) / 365.242189 + 0.5) + 1;

            if (part == 0)
            {
                return(num3);
            }
            int num4 = (int)(num - CalendricalCalculationsHelper.GetNumberOfDays(this.ToDateTime(num3, 1, 1, 0, 0, 0, 0, 1)));

            if (part == 1)
            {
                return(num4);
            }
            int num5 = PersianCalendar.MonthFromOrdinalDay(num4);

            if (part == 2)
            {
                return(num5);
            }
            int result = num4 - PersianCalendar.DaysInPreviousMonths(num5);

            if (part == 3)
            {
                return(result);
            }
            throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_DateTimeParsing"));
        }
コード例 #2
0
 /// <summary>Returns the era in the specified <see cref="T:System.DateTime" /> object.</summary>
 /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
 /// <returns>Always returns <see cref="F:System.Globalization.PersianCalendar.PersianEra" />.</returns>
 /// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="time" /> parameter represents a date less than <see cref="P:System.Globalization.PersianCalendar.MinSupportedDateTime" /> or greater than <see cref="P:System.Globalization.PersianCalendar.MaxSupportedDateTime" />.</exception>
 // Token: 0x06002F84 RID: 12164 RVA: 0x000B5DEC File Offset: 0x000B3FEC
 public override int GetEra(DateTime time)
 {
     PersianCalendar.CheckTicksRange(time.Ticks);
     return(PersianCalendar.PersianEra);
 }