gregtim.f

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\utils\bief\gregtim.f
00002 !
00043                              SUBROUTINE GREGTIM
00044 !                            ******************
00045 !
00046      &(JULTIM,YEAR,MONTH,DAY,HOUR,MINU,SEC)
00047 !
00048 !
00049 !***********************************************************************
00050 ! BIEF   V6P2                                   31/08/2011
00051 !***********************************************************************
00052 !
00053 !
00054 !
00055 !
00056 !
00057 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00058 !| DAY            |<->| DAY    (1-28, 29, 30 OR 31)
00059 !| HOUR           |<->| HOUR   (0-23) IN UNIVERSAL TIME
00060 !| JULTIM         |-->| JULIAN DAY IN CENTURY
00061 !| MIN            |<->| MINUTE (0-59) IN UNIVERSAL TIME
00062 !| MONTH          |<->| MONTH  (1-12)
00063 !| SEC            |<->| SECOND (0-59) IN UNIVERSAL TIME
00064 !| YEAR           |<->| YEAR   (-4713-..)
00065 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00066 !
00067       IMPLICIT NONE
00068 !
00069       INTEGER LNG,LU
00070       COMMON/INFO/LNG,LU
00071 !
00072 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00073 !
00074       INTEGER,          INTENT(INOUT) :: YEAR,MONTH,DAY,HOUR,MINU,SEC
00075       DOUBLE PRECISION, INTENT(IN)    :: JULTIM
00076 !
00077 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00078 !
00079       INTEGER I,J,K,L,N
00080       DOUBLE PRECISION JD,JDR
00081 !
00082       INTRINSIC INT
00083 !
00084 !-----------------------------------------------------------------------
00085 !
00086 !  JULTIM UNIT: CENTURY
00087 !  JD UNIT    : DAY
00088 !
00089 !  2415020 <=> 31/12/1899: DUE TO THE SHIFT IN JULTIM IN TELEMAC/BIEF
00090 !
00091       JD=JULTIM*36525.D0+2415020.D0
00092 !
00093       JDR=MOD(JD,1.D0)
00094 !
00095       IF (JDR.LT.0.5D0) THEN
00096         JDR = JDR+0.5D0
00097       ELSE
00098         JDR = JDR-0.5D0
00099         JD  = JD+1.D0
00100       ENDIF
00101 !
00102       L = INT(JD)+68569
00103       N = 4*L/146097
00104       L = L-(146097*N+3)/4
00105       I = 4000*(L+1)/1461001
00106       L = L-1461*I/4+31
00107       J = 80*L/2447
00108       K = L-2447*J/80
00109       L = J/11
00110       J = J+2-12*L
00111       I = 100*(N-49)+I+L
00112 !
00113       YEAR  = I
00114       MONTH = J
00115       DAY   = K
00116 !
00117       HOUR = INT(JDR*24.D0)
00118       MINU  = INT(JDR*1440.D0)-60*HOUR
00119       SEC  = NINT(JDR*86400.D0)-3600*HOUR-60*MINU
00120 !
00121 !  TO AVOID SEC = 60
00122 !
00123       IF(SEC.EQ.60) THEN
00124         SEC = 0
00125         MINU = MINU + 1
00126       ENDIF
00127 !
00128       IF(MINU.GE.60) THEN
00129         MINU  = MINU  - 60
00130         HOUR = HOUR + 1
00131       ENDIF
00132 !
00133       IF(HOUR.GE.24) THEN
00134         HOUR = HOUR - 24
00135         DAY  = DAY  + 1
00136       ENDIF
00137 !
00138 !-----------------------------------------------------------------------
00139 !
00140       RETURN
00141       END

Generated on Fri Aug 31 2013 18:12:58 by S.E.Bourban (HRW) using doxygen 1.7.0