ESMF_CalendarIsLeapYearI4 Function

private function ESMF_CalendarIsLeapYearI4(calendar, yy, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Calendar), intent(in) :: calendar
integer(kind=ESMF_KIND_I4), intent(in) :: yy
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: rc

Return Value logical


Source Code

      function ESMF_CalendarIsLeapYearI4(calendar, yy, keywordEnforcer, rc)

! !RETURN VALUE:
      logical :: ESMF_CalendarIsLeapYearI4

! !ARGUMENTS:
      type(ESMF_Calendar),   intent(in)            :: calendar
      integer(ESMF_KIND_I4), intent(in)            :: yy
      type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      integer,               intent(out), optional :: rc

!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
!     \begin{sloppypar}
!     Returns {\tt .true.} if the given year is a leap year within the given
!     calendar, and {\tt .false.} otherwise.  Custom calendars do not define
!     leap years, so {\tt .false.} will always be returned in this case;
!     see Section ~\ref{subsec:Calendar_rest}.
!     See also {\tt ESMF\_TimeIsLeapYear()}.
!     \end{sloppypar}
!
!     The arguments are:
!     \begin{description}
!     \item[calendar]
!          {\tt ESMF\_Calendar} to determine leap year within.
!     \item[yy]
!          Year to check for leap year.
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!    
!EOPI
      integer :: localrc                        ! local return code

      ! Assume failure until success
      if (present(rc)) rc = ESMF_RC_NOT_IMPL
      localrc = ESMF_RC_NOT_IMPL

      ! Initialize output value in case of error
      ESMF_CalendarIsLeapYearI4 = .false.

      ! check input
      ESMF_INIT_CHECK_DEEP(ESMF_CalendarGetInit,calendar,rc)

      ! invoke C to C++ entry point
      call c_ESMC_CalendarIsLeapYearI4(calendar, yy, &
                                       ESMF_CalendarIsLeapYearI4, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

      ! Return success
      if (present(rc)) rc = ESMF_SUCCESS    
      end function ESMF_CalendarIsLeapYearI4