public static int div_mod(out int remainder, int x, int y) { int num = CCMath.div(x, y); remainder = x - y * num; return(num); }
public static int fixed_from_dmy(int day, int month, int year) { int num = 227013; num += 354 * (year - 1); num += CCMath.div(3 + 11 * year, 30); num += (int)Math.Ceiling(29.5 * (double)(month - 1)); return(num + day); }
public static int year_from_fixed(int date) { int x = date - 1; int num = CCMath.div_mod(out x, x, 146097); int num2 = CCMath.div_mod(out x, x, 36524); int num3 = CCMath.div_mod(out x, x, 1461); int num4 = CCMath.div(x, 365); int num5 = 400 * num + 100 * num2 + 4 * num3 + num4; return((num2 != 4 && num4 != 4) ? (num5 + 1) : num5); }
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 int elapsed_days(int year) { int num = CCMath.div(235 * year - 234, 19); int num3; int num2 = CCMath.div_mod(out num3, num, 1080); int x = 204 + 793 * num3; int x2 = 11 + 12 * num + 793 * num2 + CCMath.div(x, 1080); int num4 = 29 * num + CCMath.div(x2, 24); if (CCMath.mod(3 * (num4 + 1), 7) < 3) { num4++; } return(num4); }
public static int fixed_from_dmy(int day, int month, int year) { int num = 0; num += 365 * (year - 1); num += CCMath.div(year - 1, 4); num -= CCMath.div(year - 1, 100); num += CCMath.div(year - 1, 400); num += CCMath.div(367 * month - 362, 12); if (month > 2) { num += ((!CCGregorianCalendar.is_leap_year(year)) ? -2 : -1); } return(num + 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); }
public static int mod(int x, int y) { return(x - y * CCMath.div(x, y)); }
public static int year_from_fixed(int date) { return(CCMath.div(30 * (date - 227014) + 10646, 10631)); }
public static int year_from_fixed(int date) { int num = CCMath.div(4 * (date - -1) + 1464, 1461); return((num > 0) ? num : (num - 1)); }