1 |
heimbach |
1.1 |
C $Header: /u/gcmpack/development/heimbach/ecco_env/pkg/cal/cal_isleap.F,v 1.4 2001/02/02 16:57:22 heimbach Exp $ |
2 |
|
|
|
3 |
|
|
#include "CAL_CPPOPTIONS.h" |
4 |
|
|
|
5 |
|
|
integer function cal_IsLeap( |
6 |
|
|
I year, |
7 |
|
|
I mythid |
8 |
|
|
& ) |
9 |
|
|
|
10 |
|
|
c ================================================================== |
11 |
|
|
c FUNCTION cal_IsLeap |
12 |
|
|
c ================================================================== |
13 |
|
|
c |
14 |
|
|
c o In case the Gregorian calendar is used determine whether the |
15 |
|
|
c given year is a leap year or not. |
16 |
|
|
c |
17 |
|
|
c |
18 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
19 |
|
|
c |
20 |
|
|
c changed: Christian Eckert eckert@mit.edu 29-Dec-1999 |
21 |
|
|
c |
22 |
|
|
c - restructured the original version in order to have a |
23 |
|
|
c better interface to the MITgcmUV. |
24 |
|
|
c |
25 |
|
|
c Christian Eckert eckert@mit.edu 03-Feb-2000 |
26 |
|
|
c |
27 |
|
|
c - Introduced new routine and function names, cal_<NAME>, |
28 |
|
|
c for verion 0.1.3. |
29 |
|
|
c |
30 |
|
|
c ================================================================== |
31 |
|
|
c FUNCTION cal_IsLeap |
32 |
|
|
c ================================================================== |
33 |
|
|
|
34 |
|
|
implicit none |
35 |
|
|
|
36 |
|
|
c == global variables == |
37 |
|
|
|
38 |
|
|
#include "cal.h" |
39 |
|
|
|
40 |
|
|
c == routine arguments == |
41 |
|
|
|
42 |
|
|
integer year |
43 |
|
|
integer mythid |
44 |
|
|
|
45 |
|
|
c == end of interface == |
46 |
|
|
|
47 |
|
|
if ( usingGregorianCalendar ) then |
48 |
|
|
if ( mod(year,4) .ne. 0 ) then |
49 |
|
|
cal_IsLeap = 1 |
50 |
|
|
else |
51 |
|
|
cal_IsLeap = 2 |
52 |
|
|
if ( (mod(year,100) .eq. 0) .and. |
53 |
|
|
& (mod(year,400) .ne. 0) ) then |
54 |
|
|
cal_IsLeap = 1 |
55 |
|
|
endif |
56 |
|
|
endif |
57 |
|
|
else if ( usingJulianCalendar ) then |
58 |
|
|
if ( mod(year,4) .ne. 0 ) then |
59 |
|
|
cal_IsLeap = 1 |
60 |
|
|
else |
61 |
|
|
cal_IsLeap = 2 |
62 |
|
|
endif |
63 |
|
|
else |
64 |
|
|
cal_IsLeap = 1 |
65 |
|
|
endif |
66 |
|
|
|
67 |
|
|
return |
68 |
|
|
end |
69 |
|
|
|