gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
Functions/Subroutines
dccalconverttoday.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

real(dp) function dccalconverttoday1 (in_time, in_unit, cal)
 時間を日の単位に変換
 
real(dp) function dccalconverttoday2 (in_time, in_unit, cal)
 

Function/Subroutine Documentation

◆ dccalconverttoday1()

real(dp) function dccalconverttoday1 ( real(dp), intent(in)  in_time,
character(*), intent(in)  in_unit,
type(dc_cal), intent(in), optional, target  cal 
)

時間を日の単位に変換

Author
Youhei SASAKI, Yasuhiro MORIKAWA

Definition at line 72 of file dccalconverttoday.f90.

73
78 use dc_message, only: messagenotify
79 use dc_types, only: dp
80 implicit none
81 real(DP):: out_time
82 real(DP), intent(in):: in_time
83 character(*), intent(in):: in_unit
84 type(DC_CAL), intent(in), optional, target:: cal
85
86 ! 作業変数
87 ! Work variables
88 !
89 type(DC_CAL), pointer:: calp =>null()
90 integer:: in_unit_sym, out_unit_sym
91 character(*), parameter:: subname = 'DCCalConvertToDay1'
92continue
93
94 out_time = -1.0
95
96 ! オブジェクトのポインタ割付
97 ! Associate pointer of an object
98 !
99 if ( present( cal ) ) then
100 calp => cal
101 else
102 calp => default_cal
103 if ( .not. calp % initialized ) call default_cal_set
104 end if
105
106 ! 初期設定のチェック
107 ! Check initialization
108 !
109 if ( .not. calp % initialized ) then
110 call messagenotify('W', subname, '"cal" is not initialized. <-1> is returned.' )
111 goto 999
112 end if
113
114 ! 単位の解釈
115 ! Parse units
116 !
117 in_unit_sym = dccaldate_str2usym( in_unit )
118 out_unit_sym = unit_symbol_day
119
120 ! 数値の変換
121 ! Convert a value
122 !
123 out_time = dccalconvertbyunit( in_time, in_unit_sym, out_unit_sym, cal )
124
125 ! 終了処理, 例外処理
126 ! Termination and Exception handling
127 !
128999 continue
129 nullify( calp )
dc_calendar 手続のインターフェース宣言
dc_calendar用の内部モジュール
type(dc_cal), target, save, public default_cal
デフォルトの暦. DCCal で始まる手続のうち, DC_CAL 型の省略可能引数が与えられない 場合にはこの暦が設定もしくは利用される.
subroutine, public default_cal_set
integer function, public dccaldate_str2usym(str)
暦と日時に関する構造データ型と定数
integer, parameter, public unit_symbol_day
メッセージの出力
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92

References dc_calendar_internal::dccaldate_str2usym(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_types::dp, and dc_calendar_types::unit_symbol_day.

Here is the call graph for this function:

◆ dccalconverttoday2()

real(dp) function dccalconverttoday2 ( real(dp), intent(in)  in_time,
integer, intent(in)  in_unit,
type(dc_cal), intent(in), optional, target  cal 
)

任意の単位から日への変換 (シンボル版)

任意の時間単位 (日時分秒) から日への単位の変換を行います.

時間の単位として有効な整数型変数については以下を参照下さい. 単位として整数値を直接与えることはせず, 以下の変数を与えてください.

パラメータ 説明
dc_calendar_types::UNIT_SYMBOL_SEC 秒の単位
dc_calendar_types::UNIT_SYMBOL_MIN 分の単位
dc_calendar_types::UNIT_SYMBOL_HOUR 時間の単位
dc_calendar_types::UNIT_SYMBOL_DAY 日の単位

省略可能引数 cal が省略された場合には, dc_calendar 内部で 保持される暦に関する情報を用いた単位の変換が行われます. cal が省略されない場合にはその変数に設定された暦の情報を 用いて単位の変換が行われます.

Parameters
[in]in_time変換前の時間の数値
[in]in_unit変換前の時間の単位 (整数シンボル)
[in]cal暦情報を収めたオブジェクト
Returns
変換後の時間の数値 (日単位)

Definition at line 186 of file dccalconverttoday.f90.

187
191 use dc_message, only: messagenotify
192 use dc_types, only: dp
193 implicit none
194 real(DP):: out_time
195 real(DP), intent(in):: in_time
196 integer, intent(in):: in_unit
197 type(DC_CAL), intent(in), optional, target:: cal
198
199 ! 作業変数
200 ! Work variables
201 !
202 type(DC_CAL), pointer:: calp =>null()
203 integer:: out_unit
204 character(*), parameter:: subname = 'DCCalConvertToDay2'
205continue
206
207 out_time = -1.0
208
209 ! オブジェクトのポインタ割付
210 ! Associate pointer of an object
211 !
212 if ( present( cal ) ) then
213 calp => cal
214 else
215 calp => default_cal
216 if ( .not. calp % initialized ) call default_cal_set
217 end if
218
219 ! 初期設定のチェック
220 ! Check initialization
221 !
222 if ( .not. calp % initialized ) then
223 call messagenotify('W', subname, '"cal" is not initialized. <-1> is returned.' )
224 goto 999
225 end if
226
227 ! 単位の解釈
228 ! Parse units
229 !
230 out_unit = unit_symbol_day
231
232 ! 数値の変換
233 ! Convert a value
234 !
235 out_time = dccalconvertbyunit( in_time, in_unit, out_unit, cal )
236
237 ! 終了処理, 例外処理
238 ! Termination and Exception handling
239 !
240999 continue
241 nullify( calp )

References dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_types::dp, and dc_calendar_types::unit_symbol_day.

Here is the call graph for this function: