Ju24da.cin
Jump to navigation
Jump to search
Ju24da.cin is pair of the C++ routines to evaluate the Short Julian day from date and back
Code
void ju24da(int Mjd, int *Year, int *Month, int *Day) { int J, C, Y, M; J = Mjd + 2400000 + 68569; // J = Mjd + 2400001 + 68569; // J = Mjd + 68569; C = 4 * J / 146097; J = J - (146097 * C + 3) / 4; Y = 4000 * (J + 1) / 1461001; J = J - 1461 * Y / 4 + 31; M = 80 * J / 2447; *Day = J - 2447 * M / 80; J = M / 11; *Month = M + 2 - (12 * J); *Year = 100 * (C - 49) + Y + J; // http://www.leapsecond.com/tools/gpsdate.c } int daju24(int Y,int M, int D) { int a, y,m; a=(14-M)/12; y=Y+4800-a; m=M+12*a-3; // return D + (153*m+2)/5 +365*y + y/4 - y/100 + y/400 -32045 - 2400001; return D + (153*m+2)/5 +365*y + y/4 - y/100 + y/400 -32045 - 2400000; }
References