home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* *** gtoj.c *** */
- /* */
- /* This function converts a gregorian date, in the ( month, day, year ) */
- /* format, into its respective julian, or day number, equivalent. */
- /* ( 1 = 1st day AD ) */
- /* */
- /* The legal input values, in their proper order, are: */
- /* */
- /* month = 1 to 12 ( unsigned int ) */
- /* day = 1 to 31 ( unsigned int ) */
- /* year = 0 to 9999 ( unsigned int ) */
- /* */
- /* The return value of the function is the julian day number */
- /* expressed as an unsigned long integer. */
- /* */
- /************************************************************************/
-
- long gtoj( m, d, y )
-
- unsigned int m, d, y;
-
- {
- y += ( m += 9 ) / 12 + 399;
- m %= 12;
-
- return ( (long)y*365 + y/4 - y/100 + y/400 + (153*m+2)/5 + d - 146037 );
- }