Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ESMF_KIND_I8), | intent(in) | :: | YYl | |||
type(ESMF_Calendar), | intent(inout) | :: | cal |
function ESMF_IsLeapYear(YYl, cal) ! !RETURN VALUE: logical :: ESMF_IsLeapYear ! !ARGUMENTS: integer(ESMF_KIND_I8), intent(in) :: YYl type(ESMF_Calendar), intent(inout) :: cal ! !DESCRIPTION: ! Checks given year to see if it is a leap year in the given calendar ! !EOPI integer(ESMF_KIND_I8), parameter :: ly1 = 400, ly2 = 4, ly3 = 100 logical :: leapYear if (cal .eq. ESMF_CALKIND_GREGORIAN) then ! Note: At least one Absoft compiler (in particular, version 9a SP1 on x86_64 linux) ! may miscompile the following statement - which causes a floating point error at ! runtime. See ticket #2800140. leapYear = (mod(YYl,ly1).eq.0) .or. & (mod(YYl,ly2).eq.0 .and. mod(YYl,ly3).ne.0) else if (cal .eq. ESMF_CALKIND_JULIAN) then leapYear = mod(YYl,ly2).eq.0 else !print *, "Error: Leap year rule unknown for given calendar." end if ! function return value ESMF_IsLeapYear = leapYear end function ESMF_IsLeapYear