ocssw  1.0
/disk01/web/ocssw/build/src/viirs_sim_sdr/time_utl.c (r8106/r4410)
Go to the documentation of this file.
```00001 /*
00002         subroutine jddate(jd,i,j,k)
00003 C
00004 C       This routine computes the calendar date corresponding to
00005 C       a given Julian day.  This code was brazenly copied from
00006 C       a routine written by Myron Shear for CSC on Julian Day 1.
00007 C
00008 C       ARGUMENT        TYPE    I/O     DESCRIPTION
00009 C       __________________________________________________________
00010 C        JD             I*4      I      Julian Day (reference Jan 1, 4713 BC)
00011 C        I              I*4      O      Year
00012 C        J              I*4      O      Month
00013 C        K              I*4      0      Day of Month
00014 C
00015         l = jd + 68569
00016         n = 4*l/146097
00017         l = l - (146097*n + 3)/4
00018         i = 4000*(l+1)/1461001
00019         l = l - 1461*i/4 + 31
00020         j = 80*l/2447
00021         k = l - 2447*j/80
00022         l = j/11
00023         j = j + 2 - 12*l
00024         i = 100*(n-49) + i + l
00025         return
00026         end
00027 */
00028
00029 /*
00030         subroutine jdate(jd,i,k)
00031 C
00032 C       This routine computes the year and day-of-year corresponding
00033 C       to a given Julian day.  This algorithm is designed for the
00034 C       period 1900 - 2100.
00035 C
00036 C       ARGUMENT        TYPE    I/O     DESCRIPTION
00037 C       __________________________________________________________
00038 C        JD             I*4      I      Julian Day (reference Jan 1, 4713 BC)
00039 C        I              I*4      O      Year
00040 C        K              I*4      0      Day of Year
00041 C
00042 c       Program written by:     Frederick S. Patt
00043 c                               General Sciences Corporation
00044 c                               May 12, 1993
00045
00046 c       Compute days since January 0, 1900
00047         l = jd - 2415020
00048
00049 c       Compute years since 1900
00050         i = 4*l/1461
00051
00052 c       Compute day-of-year
00053         k = l - 1461*(i-1)/4 - 365
00054
00055 c       Add first two digits of year
00056         i = i + 1900
00057         return
00058         end
00059 */
00060
00061 /*
00062       function jd(i,j,k)
00063 c
00064 c
00065 c    This function converts a calendar date to the corresponding Julian
00066 c    day starting at noon on the calendar date.  The algorithm used is
00067 c    from Van Flandern and Pulkkinen, Ap. J. Supplement Series 41,
00068 c    November 1979, p. 400.
00069 c
00070 c
00071 c       Arguments
00072 c
00073 c       Name    Type    I/O     Description
00074 c       ----    ----    ---     -----------
00075 c       i       I*4      I      Year - e.g. 1970
00076 c       j       I*4      I      Month - (1-12)
00077 c       k       I*4      I      Day  - (1-31)
00078 c       jd      I*4      O      Julian day
00079 c
00080 c     external references
00081 c     -------------------
00082 c      none
00083 c
00084 c
00085 c     Written by Frederick S. Patt, GSC, November 4, 1992
00086 c
00087 c
00088         jd = 367*i - 7*(i+(j+9)/12)/4 + 275*j/9 + k + 1721014
00089
00090 c  This additional calculation is needed only for dates outside of the
00091 c   period March 1, 1900 to February 28, 2100
00092 c       jd = jd + 15 - 3*((i+(j-9)/7)/100+1)/4
00093         return
00094         end
00095 */
00096
00097 int jd_c( int y, int m, int d )
00098   {
00099   return( 367 * y  -
00100           7 * ( y + ( m + 9 ) / 12 ) / 4  +
00101           275 * m / 9  +
00102           d + 1721014 );
00103   }
```