gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
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 )

閏年かどうかの判定

Author
Youhei SASAKI, Yasuhiro MORIKAWA

このファイルに記載される手続き群は dc_calendar モジュールから提供されます.

指定された日時が閏年かどうかを判定

閏年かどうかの判定.

省略可能引数 date が省略された場合には, dc_calendar 内部で 保持される日時が起点の日時として用いられます. date が省略されない場合にはその変数に設定された日時が 起点の日時として用いられます.

省略可能引数 cal が省略された場合には, 経過秒数 elapse_sec の年月日時分への変換に dc_calendar 内部で保持される暦が用いられます. cal が省略されない場合にはその変数に設定された暦が用いられます.

Parameters
[in]elapse_secdate からの経過秒数
[in]date起点となる日時情報を収めたオブジェクト
[in]cal暦情報を収めたオブジェクト
Returns
閏年であれば .true., そうでなければ .false.

Definition at line 64 of file dccaldatechkleapyear.f90.

65
71 use dc_types, only: dp
72 implicit none
73 logical:: result
74 real(DP), intent(in):: elapse_sec
75 type(DC_CAL_DATE), intent(in), optional, target:: date
76 type(DC_CAL), intent(in), optional, target:: cal
77
78 ! 作業変数
79 ! Work variables
80 !
81 type(DC_CAL_DATE), pointer:: datep =>null()
82 type(DC_CAL), pointer:: calp =>null()
83 integer:: year, month, day, hour, min
84 real(DP):: sec
85continue
86
87 ! オブジェクトのポインタ割付
88 ! Associate pointer of an object
89 !
90 if ( present( date ) ) then
91 datep => date
92 else
93 datep => default_date
94 end if
95
96 if ( present( cal ) ) then
97 calp => cal
98 else
99 calp => default_cal
100 if ( .not. calp % initialized ) call default_cal_set
101 end if
102
103 ! 初期設定のチェック
104 ! Check initialization
105 !
106 result = .false.
107 if ( .not. datep % initialized ) return
108 if ( .not. calp % initialized ) return
109
110 ! 経過時間を与えた場合の日時を取得
111 ! Inquire date and time when elapse time is given
112 !
113 call dccaldateinquire( year, month, day, hour, min, sec, & ! (out)
114 & elapse_sec = elapse_sec, date = datep , cal = calp ) ! (in)
115
116 ! 閏年の判定
117 ! Judge leap year
118 !
119 select case( calp % cal_type )
120 case( cal_julian )
121 if ( mod( year, 4 ) == 0 ) then
122 result = .true.
123 else
124 result = .false.
125 end if
126
127 case( cal_gregorian )
128 if ( mod( year, 400 ) == 0 ) then
129 result = .true.
130 elseif ( mod( year, 100 ) == 0 ) then
131 result = .false.
132 elseif ( mod( year, 4 ) == 0 ) then
133 result = .true.
134 else
135 result = .false.
136 end if
137
138 case default
139 result = .false.
140 end select
141
dc_calendar 手続のインターフェース宣言
dc_calendar用の内部モジュール
type(dc_cal), target, save, public default_cal
デフォルトの暦. DCCal で始まる手続のうち, DC_CAL 型の省略可能引数が与えられない 場合にはこの暦が設定もしくは利用される.
type(dc_cal_date), target, save, public default_date
デフォルトの日時. DCCalDate で始まる手続のうち, DC_CAL_DATE 型の省略可能引数が 与えられない場合にはこの日時が設定もしくは利用される.
integer function, public dccaldate_normalize(year, month, day, hour, min, sec, cal)
integer function, public dccaldate_ym2d(year, month, day, cal, day_of_year)
subroutine, public default_cal_set
暦と日時に関する構造データ型と定数
integer, parameter, public cal_julian
integer, parameter, public cal_gregorian
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92

References dc_calendar_types::cal_gregorian, dc_calendar_types::cal_julian, 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.

Here is the call graph for this function: