gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Functions/Subroutines
dccalconverttomin.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

real(dp) function dccalconverttomin1 (in_time, in_unit, cal)
 Convert time to minute unit.
 
real(dp) function dccalconverttomin2 (in_time, in_unit, cal)
 

Function/Subroutine Documentation

◆ dccalconverttomin1()

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

Convert time to minute unit.

Author
Youhei SASAKI, Yasuhiro MORIKAWA

Definition at line 72 of file dccalconverttomin.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 = 'DCCalConvertToMin1'
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_min
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 )
Interface declarations for dc_calendar procedures.
Internal module for dc_calendar.
type(dc_cal), target, save, public default_cal
Default calendar object
subroutine, public default_cal_set
integer function, public dccaldate_str2usym(str)
Derived types and parameters of calendar and date.
integer, parameter, public unit_symbol_min
Message output module.
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public dp
Double Precision Real number
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_min.

Here is the call graph for this function:

◆ dccalconverttomin2()

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

Convert time from arbitrary unit to minute (symbol version)

Convert of unit from arbitrary time units (day, hour, minute, second) into minute.

Valid integer variables as units of time are follows. Do not specify integer directly, but specify following variables.

Parameter Description
dc_calendar_types::UNIT_SYMBOL_SEC Units of second
dc_calendar_types::UNIT_SYMBOL_MIN Units of minute
dc_calendar_types::UNIT_SYMBOL_HOUR Units of hour
dc_calendar_types::UNIT_SYMBOL_DAY Units of day

If an optional argument cal is omitted, unit is converted with information of a calendar that is stored in the "dc_calendar". If cal is not omitted, unit is converted with information of the variable.

Parameters
[in]in_timeNumerical value of time before conversion
[in]in_unitUnits of time before conversion (integer symbol)
[in]calAn object that stores information of calendar
Returns
Numerical value of time after conversion (in minutes)

Definition at line 186 of file dccalconverttomin.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 = 'DCCalConvertToMin2'
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_min
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_min.

Here is the call graph for this function: