1 |
C $Header: /u/gcmpack/development/heimbach/ecco_env/pkg/cal/cal_subdates.F,v 1.4 2001/02/02 16:57:22 heimbach Exp $ |
2 |
|
3 |
#include "CAL_CPPOPTIONS.h" |
4 |
|
5 |
subroutine cal_SubDates( |
6 |
I finaldate, |
7 |
I initialdate, |
8 |
O diffdate, |
9 |
I mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE cal_SubDates |
14 |
c ================================================================== |
15 |
c |
16 |
c o Subtract two dates. In case calendar dates are given finaldate |
17 |
c must be after initialdate. |
18 |
c |
19 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
20 |
c |
21 |
c changed: Christian Eckert eckert@mit.edu 29-Dec-1999 |
22 |
c |
23 |
c - restructured the original version in order to have a |
24 |
c better interface to the MITgcmUV. |
25 |
c |
26 |
c Christian Eckert eckert@mit.edu 03-Feb-2000 |
27 |
c |
28 |
c - Introduced new routine and function names, cal_<NAME>, |
29 |
c for verion 0.1.3. |
30 |
c |
31 |
c ================================================================== |
32 |
c SUBROUTINE cal_SubDates |
33 |
c ================================================================== |
34 |
|
35 |
implicit none |
36 |
|
37 |
c == global variables == |
38 |
|
39 |
#include "cal.h" |
40 |
|
41 |
c == routine arguments == |
42 |
|
43 |
integer finaldate(4) |
44 |
integer initialdate(4) |
45 |
integer diffdate(4) |
46 |
integer mythid |
47 |
|
48 |
c == local variables == |
49 |
|
50 |
integer workdate(4) |
51 |
integer ierr |
52 |
|
53 |
c == end of interface == |
54 |
|
55 |
if ((initialdate(4) .gt. 0) .eqv. |
56 |
& ( finaldate(4) .gt. 0)) then |
57 |
|
58 |
|
59 |
if (initialdate(4) .eq. -1) then |
60 |
c The time interval is subtracted. |
61 |
workdate(1) = -initialdate(1) |
62 |
workdate(2) = -initialdate(2) |
63 |
workdate(3) = 0 |
64 |
workdate(4) = -1 |
65 |
call cal_AddTime( finaldate, workdate, diffdate, mythid ) |
66 |
else |
67 |
c The time interval between initial and final date is calculated. |
68 |
call cal_TimePassed( |
69 |
& initialdate, finaldate, diffdate, mythid ) |
70 |
endif |
71 |
else |
72 |
|
73 |
ierr = 801 |
74 |
call cal_PrintError( ierr, mythid ) |
75 |
stop ' stopped in cal_SubDates.' |
76 |
|
77 |
endif |
78 |
|
79 |
100 continue |
80 |
|
81 |
return |
82 |
end |