gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dcdatetimeputline.f90
Go to the documentation of this file.
1! -*- mode: f90; coding: utf-8 -*-
2!-----------------------------------------------------------------------
3! Copyright (c) 2000-2026 Gtool Development Group. All rights reserved.
4!-----------------------------------------------------------------------
5!>
6!> @author Yasuhiro MORIKAWA
7!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
8!> License is BSD-2-Clause. see [COPYRIGHT](@ref COPYRIGHT) in detail
9!> @en
10!> @brief Print DC_DATETIME, DC_DIFFTIME information
11!> @details
12!> Procedures described in this file are provided from "dc_date" module.
13!> @enden
14!>
15!> @ja
16!> @brief dc_date_types#DC_DATETIME, dc_date_types#DC_DIFFTIME の印字
17!> @details
18!> このファイルで提供される手続き群は dc_date モジュールにて提供されます。
19!> @endja
20!>
21
22!> @en
23!> @brief Print information of DC_DATETIME
24!> @details
25!> Print the information set in the argument `time`.
26!> By default, messages are output to standard output.
27!> The output destination can be changed by specifying a unit number in `unit`.
28!>
29!> @param[in] time Datetime to print
30!> @param[in] unit Unit number for output (default: standard output)
31!> @param[in] indent Indentation for displayed messages
32!> @enden
33!>
34!> @ja
35!> @brief DC_DATETIME の情報を印字
36!> @details
37!> 引数 `time` に設定されている情報を印字します.
38!> デフォルトではメッセージは標準出力に出力されます.
39!> `unit` に装置番号を指定することで, 出力先を変更することが可能です.
40!>
41!> @param[in] time 印字する日時
42!> @param[in] unit 出力先の装置番号 (デフォルト: 標準出力)
43!> @param[in] indent 表示されるメッセージの字下げ
44!> @endja
45subroutine dcdatetimeputline( time, unit, indent )
46
47 use dc_date_types, only: dc_datetime
48 use dc_date_generic, only: tochar
49 use dc_string, only: printf
50 use dc_trace, only: beginsub, endsub
51 use dc_types, only: stdout, string
53 implicit none
54 type(dc_datetime), intent(in) :: time
55 integer, intent(in), optional :: unit
56 character(*), intent(in), optional:: indent
57
58 integer :: out_unit
59 integer:: indent_len
60 character(STRING):: indent_str
61 character(*), parameter :: subname = 'DCDateTimePutLine'
62continue
63 call beginsub(subname)
64 if (present(unit)) then
65 out_unit = unit
66 else
67 out_unit = stdout
68 end if
69
70 indent_len = 0
71 indent_str = ''
72 if ( present(indent) ) then
73 if ( len(indent) /= 0 ) then
74 indent_len = len(indent)
75 indent_str(1:indent_len) = indent
76 end if
77 end if
78
79 call printf(out_unit, &
80 & indent_str(1:indent_len) // &
81 & '#<DC_DATETIME:: @date=%c @caltype=%d @zone=%c', &
82 & i=(/time % caltype/), c1=trim(tochar(time)), c2=trim(time % zone) )
83
84 call printf(out_unit, &
85 & indent_str(1:indent_len) // &
86 & ' @day=' )
87 call dcscaledsecputline( time % day, unit = unit, &
88 & indent = indent_str(1:indent_len) // &
89 & ' ' )
90
91 call printf(out_unit, &
92 & indent_str(1:indent_len) // &
93 & ' @sec=' )
94 call dcscaledsecputline( time % sec, unit = unit, &
95 & indent = indent_str(1:indent_len) // &
96 & ' ' )
97
98 call printf(out_unit, &
99 & indent_str(1:indent_len) // '>' )
100
101 call endsub(subname)
102end subroutine dcdatetimeputline
103
104!> @en
105!> @brief Print information of DC_DIFFTIME
106!> @details
107!> Print the information set in the argument `diff`.
108!> By default, messages are output to standard output.
109!> The output destination can be changed by specifying a unit number in `unit`.
110!>
111!> @param[in] diff Time difference to print
112!> @param[in] unit Unit number for output (default: standard output)
113!> @param[in] indent Indentation for displayed messages
114!> @enden
115!>
116!> @ja
117!> @brief DC_DIFFTIME の情報を印字
118!> @details
119!> 引数 `diff` に設定されている情報を印字します.
120!> デフォルトではメッセージは標準出力に出力されます.
121!> `unit` に装置番号を指定することで, 出力先を変更することが可能です.
122!>
123!> @param[in] diff 印字する日時差
124!> @param[in] unit 出力先の装置番号 (デフォルト: 標準出力)
125!> @param[in] indent 表示されるメッセージの字下げ
126!> @endja
127subroutine dcdifftimeputline( diff, unit, indent )
128
129 use dc_date_types, only: dc_difftime
130 use dc_date_generic, only: tochar
131 use dc_string, only: printf
132 use dc_trace, only: beginsub, endsub
133 use dc_types, only: stdout, string
135 implicit none
136 type(dc_difftime), intent(in) :: diff
137 integer, intent(in), optional :: unit
138 character(*), intent(in), optional:: indent
139
140 integer :: out_unit
141 integer:: indent_len
142 character(STRING):: indent_str
143 character(*), parameter :: subname = 'DCDiffTimePutLine'
144continue
145 call beginsub(subname)
146 if (present(unit)) then
147 out_unit = unit
148 else
149 out_unit = stdout
150 end if
151
152 indent_len = 0
153 indent_str = ''
154 if ( present(indent) ) then
155 if ( len(indent) /= 0 ) then
156 indent_len = len(indent)
157 indent_str(1:indent_len) = indent
158 end if
159 end if
160
161 call printf(out_unit, &
162 & indent_str(1:indent_len) // &
163 & '#<DC_DIFFTIME:: @diff=%c @nondim=%b', &
164 & c1 = trim(tochar(diff)), l = (/ diff % nondim_flag /) )
165
166 call printf(out_unit, &
167 & indent_str(1:indent_len) // &
168 & ' @mon=' )
169 call dcscaledsecputline( diff % mon, unit = unit, &
170 & indent = indent_str(1:indent_len) // &
171 & ' ' )
172
173 call printf(out_unit, &
174 & indent_str(1:indent_len) // &
175 & ' @day=' )
176 call dcscaledsecputline( diff % day, unit = unit, &
177 & indent = indent_str(1:indent_len) // &
178 & ' ' )
179
180 call printf(out_unit, &
181 & indent_str(1:indent_len) // &
182 & ' @sec=' )
183 call dcscaledsecputline( diff % sec, unit = unit, &
184 & indent = indent_str(1:indent_len) // &
185 & ' ' )
186
187 call printf(out_unit, &
188 & indent_str(1:indent_len) // '>' )
189
190 call endsub(subname)
191end subroutine dcdifftimeputline
192
193
194!-----------------------------------------------
195!> @en
196!> @brief Print DC_DATETIME (for backward compatibility)
197!> @param[in] time Datetime to print
198!> @param[in] unit Unit number for output
199!> @enden
200!> @ja
201!> @brief DC_DATETIME の印字 (後方互換用)
202!> @param[in] time 印字する日時
203!> @param[in] unit 出力先の装置番号
204!> @endja
205subroutine dcdatetimeputline_bc(time, unit)
206 use dc_date_types, only: dc_datetime
208 type(dc_datetime), intent(in) :: time
209 integer, intent(in), optional :: unit
210continue
211 call dcdatetimeputline( time, unit )
212end subroutine dcdatetimeputline_bc
213
214!> @en
215!> @brief Print DC_DIFFTIME (for backward compatibility)
216!> @param[in] diff Time difference to print
217!> @param[in] unit Unit number for output
218!> @enden
219!> @ja
220!> @brief DC_DIFFTIME の印字 (後方互換用)
221!> @param[in] diff 印字する日時差
222!> @param[in] unit 出力先の装置番号
223!> @endja
224subroutine dcdifftimeputline_bc(diff, unit)
225 use dc_date_types, only: dc_difftime
227 type(dc_difftime), intent(in) :: diff
228 integer, intent(in), optional :: unit
229continue
230 call dcdifftimeputline( diff, unit )
231end subroutine dcdifftimeputline_bc
subroutine dcdifftimeputline_bc(diff, unit)
subroutine dcdatetimeputline_bc(time, unit)
subroutine dcdifftimeputline(diff, unit, indent)
subroutine dcdatetimeputline(time, unit, indent)
Print DC_DATETIME, DC_DIFFTIME information.
Interface declarations for procedures provided from dc_date.
Derived types and parameters for date and time.
Scaled seconds module for precise time operations.
subroutine, public dcscaledsecputline(sclsec, unit, indent)
Handling character types.
Definition dc_string.f90:83
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
integer, parameter, public stdout
Unit number for Standard OUTPUT
Definition dc_types.f90:117