Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | jflag | ||||
integer | :: | jdate | ||||
integer | :: | gyyyy | ||||
integer | :: | gmm | ||||
integer | :: | gdd |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE JGDate(jflag,jdate,gyyyy,gmm,gdd)
! SUBROUTINE INFORMATION:
! AUTHOR <author>
! DATE WRITTEN <date_written>
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Subroutine JGDate is a gregorian date to actual julian date
! converter. the advantage of storing a julian date in the
! jdate format rather than a 5 digit format is that any
! number of days can be add or subtracted to jdate and
! that result is a proper julian date.
! METHODOLOGY EMPLOYED:
! <description>
! REFERENCES:
! for discussion of this algorithm,
! see cacm, vol 11, no 10, oct 1968, page 657
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER :: jflag ! indicates direction of conversion,
! 1 --> gregorian (dd/mm/yyyy) to julian
! 2 --> julian to gregorian.
INTEGER :: jdate ! input/output julian date, typically a 7 or 8 digit integer
INTEGER :: gyyyy ! input/output gregorian year, should be specified as 4 digits
INTEGER :: gmm ! input/output gregorian month
INTEGER :: gdd ! input/output gregorian day
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: tdate ! integer*4 variable needed for double precision arithmetic
INTEGER :: tyyyy ! integer*4 variable needed for double precision arithmetic
INTEGER :: tmm ! integer*4 variable needed for double precision arithmetic
INTEGER :: tdd ! integer*4 variable needed for double precision arithmetic
INTEGER :: l ! temporary variable used in conversion.
INTEGER :: n ! temporary variable used in conversion.
!
! gregorian to julian
!
if (jflag == 1) then
tyyyy=gyyyy
tmm=gmm
tdd=gdd
l= (tmm - 14) / 12
jdate = tdd - 32075 + 1461 * (tyyyy + 4800 + l)/4 + 367 * (tmm - 2 - l*12)/12 - 3 * ((tyyyy + 4900 + l)/100)/4
elseif (jflag == 2) then
!
! julian to gregorian
!
tdate = jdate
l = tdate + 68569
n = 4*l / 146097
l = l - (146097*n + 3) / 4
tyyyy = 4000*(l+1) / 1461001
l = l- 1461*tyyyy / 4 + 31
tmm = 80*l / 2447
tdd = l - 2447*tmm / 80
l = tmm/11
tmm = tmm + 2 - 12*l
tyyyy = 100 * (n - 49) + tyyyy + l
!c
gyyyy = tyyyy
gdd = tdd
gmm = tmm
endif
!c
return
END SUBROUTINE JGDate