Loading...
Searching...
No Matches
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 )

Definition at line 1 of file dccalconverttoday.f90.

2 !
3 ! 任意の時間単位 (日時分秒) から秒への単位の変換を行います.
4 !
5 ! 時間の単位として有効な文字列については以下を参照下さい.
6 !
7 ! dc_calendar_types#UNIT_SEC :: 秒の単位
8 ! dc_calendar_types#UNIT_MIN :: 分の単位
9 ! dc_calendar_types#UNIT_HOUR :: 時間の単位
10 ! dc_calendar_types#UNIT_DAY :: 日の単位
11 !
12 ! 省略可能引数 *cal* が省略された場合には, dc_calendar 内部で
13 ! 保持される暦に関する情報を用いた単位の変換が行われます.
14 ! *cal* が省略されない場合にはその変数に設定された暦の情報を
15 ! 用いて単位の変換が行われます.
16 !
17 ! Convert of unit from arbitrary time units (day, hour, minute, second)
18 ! into sec.
19 !
20 ! Valid strings as units of time are follows.
21 !
22 ! dc_calendar_types#UNIT_SEC :: Units of second
23 ! dc_calendar_types#UNIT_MIN :: Units of minute
24 ! dc_calendar_types#UNIT_HOUR :: Units of hour
25 ! dc_calendar_types#UNIT_DAY :: Units of day
26 !
27 ! If an optional argument *cal* is omitted,
28 ! unit is converted with information of a calendar
29 ! that is stored in the "dc_calendar".
30 ! If *cal* is not omitted, unit is converted with information of the variable.
31 !
34 use dc_calendar_types, only: dc_cal, &
39 use dc_message, only: messagenotify
40 use dc_trace, only: beginsub, endsub
41 use dc_types, only: dp, token, string
42 implicit none
43 real(DP):: out_time
44 ! 変換後の時間の数値.
45 !
46 ! Numerical value of time after conversion.
47
48 real(DP), intent(in):: in_time
49 ! 変換前の時間の数値.
50 !
51 ! Numerical value of time before conversion.
52 character(*), intent(in):: in_unit
53 ! 変換前の時間の単位.
54 !
55 ! Units of time before conversion.
56 type(DC_CAL), intent(in), optional, target:: cal
57 ! 暦情報を収めたオブジェクト.
58 !
59 ! An object that stores information of
60 ! calendar.
61
62 ! 作業変数
63 ! Work variables
64 !
65 type(DC_CAL), pointer:: calp =>null()
66 integer:: in_unit_sym, out_unit_sym
67!!$ integer:: stat
68!!$ character(STRING):: cause_c
69 character(*), parameter:: subname = 'DCCalConvertToDay1'
70continue
71!!$ call BeginSub( subname )
72!!$ stat = DC_NOERR
73!!$ cause_c = ''
74
75 out_time = -1.0
76
77 ! オブジェクトのポインタ割付
78 ! Associate pointer of an object
79 !
80 if ( present( cal ) ) then
81 calp => cal
82 else
83 calp => default_cal
84 if ( .not. calp % initialized ) call default_cal_set
85 end if
86
87 ! 初期設定のチェック
88 ! Check initialization
89 !
90 if ( .not. calp % initialized ) then
91 call messagenotify('W', subname, '"cal" is not initialized. <-1> is returned.' )
92!!$ stat = DC_ENOTINIT
93!!$ cause_c = 'DC_CAL'
94 goto 999
95 end if
96
97 ! 単位の解釈
98 ! Parse units
99 !
100 in_unit_sym = dccaldate_str2usym( in_unit )
101 out_unit_sym = unit_symbol_day
102
103 ! 数値の変換
104 ! Convert a value
105 !
106 out_time = dccalconvertbyunit( in_time, in_unit_sym, out_unit_sym, cal )
107
108 ! 終了処理, 例外処理
109 ! Termination and Exception handling
110 !
111999 continue
112 nullify( calp )
113!!$ call StoreError( stat, subname, err, cause_c )
114!!$ call EndSub( subname )
type(dc_cal), target, save, public default_cal
character(token) function, public dccaltype_str(cal_type)
subroutine, public default_cal_set
integer function, public dccaldate_str2usym(str)
integer, parameter, public unit_symbol_sec
integer, parameter, public unit_symbol_month
integer, parameter, public unit_symbol_year
integer, parameter, public unit_symbol_hour
integer, parameter, public unit_symbol_day
integer, parameter, public unit_symbol_min
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:830
integer, parameter, public dc_ebadunit
Definition dc_error.f90:559
integer, parameter, public dc_enotinit
Definition dc_error.f90:557
integer, parameter, public dc_noerr
Definition dc_error.f90:509
種別型パラメタを提供します。
Definition dc_types.f90:49
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition dc_types.f90:109
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:118
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:83

References dc_error::dc_ebadunit, dc_error::dc_enotinit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_str2usym(), dc_calendar_internal::dccaltype_str(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_types::dp, dc_error::storeerror(), dc_types::string, dc_types::token, dc_calendar_types::unit_symbol_day, dc_calendar_types::unit_symbol_hour, dc_calendar_types::unit_symbol_min, dc_calendar_types::unit_symbol_month, dc_calendar_types::unit_symbol_sec, and dc_calendar_types::unit_symbol_year.

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 )

Definition at line 119 of file dccalconverttoday.f90.

120 !
121 ! 任意の時間単位 (日時分秒) から秒への単位の変換を行います.
122 !
123 ! 時間の単位として有効な整数型変数については以下を参照下さい.
124 ! 単位として整数値を直接与えることはせず, 以下の変数を
125 ! 与えてください.
126 !
127 ! dc_calendar_types#UNIT_SYMBOL_SEC :: 秒の単位
128 ! dc_calendar_types#UNIT_SYMBOL_MIN :: 分の単位
129 ! dc_calendar_types#UNIT_SYMBOL_HOUR :: 時間の単位
130 ! dc_calendar_types#UNIT_SYMBOL_DAY :: 日の単位
131 !
132 ! 省略可能引数 *cal* が省略された場合には, dc_calendar 内部で
133 ! 保持される暦に関する情報を用いた単位の変換が行われます.
134 ! *cal* が省略されない場合にはその変数に設定された暦の情報を
135 ! 用いて単位の変換が行われます.
136 !
137 ! Convert of unit from arbitrary time units (day, hour, minute, second)
138 ! into sec.
139 !
140 ! Valid integer variables as units of time are follows.
141 ! Do not specify integer directly, but specify following variables.
142 !
143 ! dc_calendar_types#UNIT_SYMBOL_SEC :: Units of second
144 ! dc_calendar_types#UNIT_SYMBOL_MIN :: Units of minute
145 ! dc_calendar_types#UNIT_SYMBOL_HOUR :: Units of hour
146 ! dc_calendar_types#UNIT_SYMBOL_DAY :: Units of day
147 !
148 ! If an optional argument *cal* is omitted,
149 ! unit is converted with information of a calendar
150 ! that is stored in the "dc_calendar".
151 ! If *cal* is not omitted, unit is converted with information of the variable.
152 !
156 use dc_calendar_types, only: dc_cal, &
160 use dc_message, only: messagenotify
161 use dc_trace, only: beginsub, endsub
162 use dc_types, only: dp, token, string
163 implicit none
164 real(DP):: out_time
165 ! 変換後の時間の数値.
166 !
167 ! Numerical value of time after conversion.
168 real(DP), intent(in):: in_time
169 ! 変換前の時間の数値.
170 !
171 ! Numerical value of time before conversion.
172 integer, intent(in):: in_unit
173 ! 変換前の時間の単位.
174 !
175 ! Units of time before conversion.
176 type(DC_CAL), intent(in), optional, target:: cal
177 ! 暦情報を収めたオブジェクト.
178 !
179 ! An object that stores information of
180 ! calendar.
181
182 ! 作業変数
183 ! Work variables
184 !
185 type(DC_CAL), pointer:: calp =>null()
186 integer:: out_unit
187 ! 変換後の時間の単位.
188 !
189 ! Units of time after conversion.
190
191!!$ integer:: stat
192!!$ character(STRING):: cause_c
193 character(*), parameter:: subname = 'DCCalConvertToDay2'
194continue
195!!$ call BeginSub( subname )
196!!$ stat = DC_NOERR
197!!$ cause_c = ''
198
199 out_time = -1.0
200
201 ! オブジェクトのポインタ割付
202 ! Associate pointer of an object
203 !
204 if ( present( cal ) ) then
205 calp => cal
206 else
207 calp => default_cal
208 if ( .not. calp % initialized ) call default_cal_set
209 end if
210
211 ! 初期設定のチェック
212 ! Check initialization
213 !
214 if ( .not. calp % initialized ) then
215 call messagenotify('W', subname, '"cal" is not initialized. <-1> is returned.' )
216!!$ stat = DC_ENOTINIT
217!!$ cause_c = 'DC_CAL'
218 goto 999
219 end if
220
221 ! 単位の解釈
222 ! Parse units
223 !
224 out_unit = unit_symbol_day
225
226 ! 数値の変換
227 ! Convert a value
228 !
229 out_time = dccalconvertbyunit( in_time, in_unit, out_unit, cal )
230
231 ! 終了処理, 例外処理
232 ! Termination and Exception handling
233 !
234999 continue
235 nullify( calp )
236!!$ call StoreError( stat, subname, err, cause_c )
237!!$ call EndSub( subname )

References dc_error::dc_ebadunit, dc_error::dc_enotinit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_str2usym(), dc_calendar_internal::dccaltype_str(), dc_calendar_internal::default_cal, dc_calendar_internal::default_cal_set(), dc_types::dp, dc_error::storeerror(), dc_types::string, dc_types::token, dc_calendar_types::unit_symbol_day, dc_calendar_types::unit_symbol_hour, dc_calendar_types::unit_symbol_min, dc_calendar_types::unit_symbol_month, dc_calendar_types::unit_symbol_sec, and dc_calendar_types::unit_symbol_year.

Here is the call graph for this function: