is_leap_year() public static method

The method tells whether the year is a leap year.
public static is_leap_year ( int year ) : bool
year int An integer representing the Julian year. ///
return bool
        public static int fixed_from_dmy(int day, int month, int year)
        {
            int num  = (year >= 0) ? year : (year + 1);
            int num2 = -2;

            num2 += 365 * (num - 1);
            num2 += CCMath.div(num - 1, 4);
            num2 += CCMath.div(367 * month - 362, 12);
            if (month > 2)
            {
                num2 += ((!CCJulianCalendar.is_leap_year(year)) ? -2 : -1);
            }
            return(num2 + day);
        }
        public static void my_from_fixed(out int month, out int year, int date)
        {
            year = CCJulianCalendar.year_from_fixed(date);
            int num = date - CCJulianCalendar.fixed_from_dmy(1, 1, year);
            int num2;

            if (date < CCJulianCalendar.fixed_from_dmy(1, 3, year))
            {
                num2 = 0;
            }
            else if (CCJulianCalendar.is_leap_year(year))
            {
                num2 = 1;
            }
            else
            {
                num2 = 2;
            }
            month = CCMath.div(12 * (num + num2) + 373, 367);
        }
Esempio n. 3
0
 /// <summary>
 /// Overridden. Tells whether the given year
 /// is a leap year.
 /// </summary>
 /// <param name="year">An integer that specifies the year in the
 /// given era.
 /// </param>
 /// <param name="era">An integer that specifies the era.
 /// </param>
 /// <returns>A boolean that tells whether the given year is a leap
 /// year.
 /// </returns>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 /// The exception is thrown, if the year or era is not
 /// valid.
 /// </exception>
 public override bool IsLeapYear(int year, int era)
 {
     M_CheckYE(year, ref era);
     return(CCJulianCalendar.is_leap_year(year));
 }