float moon_phase(int y, int m, int d) { static const int known_full_moon = 51550; //2000 1 6 int julianDay = gregorian_calendar_to_jd(y,m,d); float phase = (julianDay - known_full_moon)/29.53f; phase = phase - (int)(phase); return phase; }
/* date2es ** Converts a standard Gregorian date and UT (YYYY/MM/DD HH:MM:SS) to ** ephemeris seconds past J2000, as required by CXFORM ** ** Modification History: ** 2003/11/11: Ryan Boller - initial version */ long date2es(int yyyy, int mm, int dd, int hh, int mm2, int ss) { return cxRound((gregorian_calendar_to_jd(yyyy, mm, dd, hh, mm2, ss) - 2451545) * 86400); }