37 |
|
|
38 |
C == routine arguments == |
C == routine arguments == |
39 |
INTEGER date(4) |
INTEGER date(4) |
40 |
|
INTEGER yy, mm, dd |
41 |
|
INTEGER ss, lp, wd |
42 |
INTEGER myThid |
INTEGER myThid |
43 |
|
|
44 |
C == local variables == |
C == local variables == |
|
INTEGER yy |
|
|
INTEGER mm |
|
|
INTEGER dd |
|
|
INTEGER ss |
|
|
INTEGER lp |
|
|
INTEGER wd |
|
45 |
INTEGER fac |
INTEGER fac |
46 |
INTEGER date_1 |
INTEGER date_1 |
47 |
INTEGER date_2 |
INTEGER date_2 |
48 |
INTEGER ierr |
INTEGER ierr |
49 |
INTEGER check_sign |
LOGICAL wrong_sign |
50 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
51 |
C == end of interface == |
C == end of interface == |
52 |
|
|
60 |
STOP 'ABNORMAL END: S/R CAL_CONVDATE' |
STOP 'ABNORMAL END: S/R CAL_CONVDATE' |
61 |
ENDIF |
ENDIF |
62 |
|
|
|
fac = 1 |
|
|
|
|
63 |
C Check the sign of the date. |
C Check the sign of the date. |
64 |
|
fac = 1 |
65 |
|
wrong_sign = ( (date(1).lt.0) .and. date(2).gt.0 ) |
66 |
|
& .OR. ( (date(1).gt.0) .and. date(2).lt.0 ) |
67 |
|
|
68 |
check_sign = 1 |
if ( wrong_sign ) then |
69 |
if ( ( (date(1).lt.0) .and. date(2).gt.0 ) .or. |
ierr = 901 |
70 |
& ( (date(1).gt.0) .and. date(2).lt.0 ) ) |
call cal_PrintError( ierr, myThid ) |
71 |
& check_sign = -1 |
stop ' stopped in cal_ConvDate.' |
72 |
|
else |
73 |
if ( check_sign .ge. 0 ) then |
if ( date(1).lt.0 .OR. date(2).lt.0 ) then |
|
if (date(1) .eq. 0) then |
|
|
date_1 = date(1) |
|
|
if (date(2) .lt. 0) then |
|
|
date_2 = -date(2) |
|
|
fac = -1 |
|
|
else |
|
|
date_2 = date(2) |
|
|
fac = 1 |
|
|
endif |
|
|
else if (date(1) .lt. 0) then |
|
74 |
date_1 = -date(1) |
date_1 = -date(1) |
75 |
date_2 = -date(2) |
date_2 = -date(2) |
76 |
fac = -1 |
fac = -1 |
79 |
date_2 = date(2) |
date_2 = date(2) |
80 |
fac = 1 |
fac = 1 |
81 |
endif |
endif |
|
else |
|
|
|
|
|
ierr = 901 |
|
|
call cal_PrintError( ierr, myThid ) |
|
|
stop ' stopped in cal_ConvDate.' |
|
|
|
|
82 |
endif |
endif |
83 |
|
|
84 |
C Decompose the entries. |
C Decompose the entries. |
92 |
dd = date_1 |
dd = date_1 |
93 |
endif |
endif |
94 |
ss = mod(date_2,100) + |
ss = mod(date_2,100) + |
95 |
& mod(date_2/100,100)*secondsperminute + |
& mod(date_2/100,100)*secondsPerMinute + |
96 |
& date_2/10000*secondsperhour |
& date_2/10000*secondsPerHour |
97 |
|
|
98 |
C Include the sign. |
C Include the sign. |
99 |
yy = fac*yy |
yy = fac*yy |
106 |
|
|
107 |
RETURN |
RETURN |
108 |
END |
END |
|
|
|