dccaldatechkleapyear.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

logical function dccaldatechkleapyear1 (elapse_sec, date, cal)
 

Function/Subroutine Documentation

◆ dccaldatechkleapyear1()

logical function dccaldatechkleapyear1 ( real(dp), intent(in)  elapse_sec,
type(dc_cal_date), intent(in), optional, target  date,
type(dc_cal), intent(in), optional, target  cal 
)

Definition at line 15 of file dccaldatechkleapyear.f90.

References dc_calendar_types::cal_360day, dc_calendar_types::cal_cyclic, dc_calendar_types::cal_gregorian, dc_calendar_types::cal_julian, dc_calendar_types::cal_noleap, dc_calendar_types::cal_user_defined, dc_calendar_internal::dccaldate_normalize(), dc_calendar_internal::dccaldate_ym2d(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_calendar_internal::default_date, and dc_types::dp.

15  ! 閏年かどうかの判定.
16  !
17  ! 省略可能引数 *date* が省略された場合には, dc_calendar 内部で
18  ! 保持される日時が起点の日時として用いられます.
19  ! *date* が省略されない場合にはその変数に設定された日時が
20  ! 起点の日時として用いられます.
21  !
22  ! 省略可能引数 *cal* が省略された場合には, 経過秒数 *elapse_sec*
23  ! の年月日時分への変換に dc_calendar 内部で保持される暦が用いられます.
24  ! *cal* が省略されない場合にはその変数に設定された暦が用いられます.
25  !
26  ! Judge whether it is a leap year.
27  !
28  ! If an optional argument *date* is omitted,
29  ! information of date that is stored in the "dc_calendar"
30  ! is used as date of origin,
31  ! If *date* is not omitted, information of the variable is used as
32  ! date of origin.
33  !
34  ! If an optional argument *cal* is omitted,
35  ! information of calendar that is stored in the "dc_calendar"
36  ! is used for conversion of elapsed seconds *elapse_sec* into
37  ! year-month-day etc.
38  ! If *cal* is not omitted, information of the variable is used.
39  !
40  use dc_calendar_types, only: dc_cal_date, dc_cal, &
41  & cal_user_defined, &
46  use dc_types, only: dp
47  implicit none
48  logical:: result
49  ! 閏年であれば .true., そうでなければ .false.
50  !
51  ! Leap year: .true., No leap year: .false.
52  real(DP), intent(in):: elapse_sec
53  ! *date* からの経過秒数.
54  ! Elapsed seconds from *date*.
55  type(dc_cal_date), intent(in), optional, target:: date
56  ! 起点となる日時情報を収めたオブジェクト.
57  !
58  ! An object that stores information of
59  ! date of origin.
60  type(dc_cal), intent(in), optional, target:: cal
61  ! 暦情報を収めたオブジェクト.
62  !
63  ! An object that stores information of
64  ! calendar.
65  ! 作業変数
66  ! Work variables
67  !
68  type(dc_cal_date), pointer:: datep =>null()
69  type(dc_cal), pointer:: calp =>null()
70  integer:: year, month, day, hour, min
71  real(DP):: sec
72 continue
73 
74  ! オブジェクトのポインタ割付
75  ! Associate pointer of an object
76  !
77  if ( present( date ) ) then
78  datep => date
79  else
80  datep => default_date
81  end if
82 
83  if ( present( cal ) ) then
84  calp => cal
85  else
86  calp => default_cal
87  if ( .not. calp % initialized ) call default_cal_set
88  end if
89 
90  ! 初期設定のチェック
91  ! Check initialization
92  !
93  result = .false.
94  if ( .not. datep % initialized ) return
95  if ( .not. calp % initialized ) return
96 
97  ! 経過時間を与えた場合の日時を取得
98  ! Inquire date and time when elapse time is given
99  !
100  call dccaldateinquire( year, month, day, hour, min, sec, & ! (out)
101  & elapse_sec = elapse_sec, date = datep , cal = calp ) ! (in)
102 
103  ! 閏年の判定
104  ! Judge leap year
105  !
106  select case( calp % cal_type )
107  case( cal_julian )
108  if ( mod( year, 4 ) == 0 ) then
109  result = .true.
110  else
111  result = .false.
112  end if
113 
114  case( cal_gregorian )
115  if ( mod( year, 400 ) == 0 ) then
116  result = .true.
117  elseif ( mod( year, 100 ) == 0 ) then
118  result = .false.
119  elseif ( mod( year, 4 ) == 0 ) then
120  result = .true.
121  else
122  result = .false.
123  end if
124 
125  case default
126  result = .false.
127  end select
128 
integer, parameter, public cal_gregorian
integer, parameter, public cal_julian
integer, parameter, public cal_user_defined
integer, parameter, public cal_noleap
type(dc_cal), target, save, public default_cal
integer function, public dccaldate_ym2d(year, month, day, cal, day_of_year)
integer function, public dccaldate_normalize(year, month, day, hour, min, sec, cal)
integer, parameter, public cal_360day
type(dc_cal_date), target, save, public default_date
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public cal_cyclic
subroutine, public default_cal_set
Here is the call graph for this function: