is_leap_year Function

public function is_leap_year(year)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: year

Return Value logical


Called by

proc~~is_leap_year~~CalledByGraph proc~is_leap_year is_leap_year proc~day_of_month day_of_month proc~day_of_month->proc~is_leap_year proc~days_in_month days_in_month proc~days_in_month->proc~is_leap_year proc~time_initialise time_initialise proc~time_initialise->proc~is_leap_year proc~initialise initialise proc~initialise->proc~time_initialise proc~management_initialise management_initialise proc~initialise->proc~management_initialise proc~management_convert_to_daily management_convert_to_daily proc~management_convert_to_daily->proc~days_in_month proc~management_read_time_series management_read_time_series proc~management_read_time_series->proc~management_convert_to_daily program~swim swim program~swim->proc~initialise proc~management_read_wu_inout management_read_wu_inout proc~management_read_wu_inout->proc~management_read_time_series proc~management_initialise->proc~management_read_wu_inout

Contents

Source Code


Source Code

  logical function is_leap_year(year)

    ! returns .true. if year is a leap year, otherwise .false.
    integer, intent(in) :: year
    logical :: cond1, cond2, cond3

    cond1 = .false.
    cond2 = .false.
    cond3 = .false.
    is_leap_year = .true.

    if (mod(year, 4) == 0) cond1 = .true.
    if (mod(year, 100) == 0) cond2 = .true.
    if (mod(year, 400) == 0) cond3 = .true.

    if (cond1 .eqv. .false.) then
      is_leap_year = .false.
    else
      if ((cond2) .and. (cond3 .eqv. .false.)) is_leap_year = .false.
    end if

  end function is_leap_year