@@ -105,7 +105,7 @@ int main()
105105
106106#### 出力例
107107```
108- 2019-10-24 11:15:27 GPS
108+ 2019-10-24 11:15:27
109109```
110110
111111### 入力の例
@@ -128,32 +128,35 @@ int main()
128128
129129 if (ss) {
130130 std::cout << tp << std::endl;
131- }
132- else {
131+ } else {
133132 std::cout << "解析失敗" << std::endl;
134133 }
135134 }
136135
137136 // タイムゾーンを含む入力
138137 {
139138 std::stringstream ss;
140- ss << "2019-10-24 20:15:10 GPS";
139+ ss << "2019-10-24 20:15:27 GPS";
141140
142141 chrono::gps_seconds tp;
143142 std::string abbrev;
144- chrono::from_stream(ss, "%Y-%m-%d %H:%M:%S %Z%z ", tp, &abbrev);
143+ chrono::from_stream(ss, "%Y-%m-%d %H:%M:%S %Z", tp, &abbrev);
145144
146- std::cout << tp << std::endl;
147- std::cout << abbrev << std::endl;
145+ if (ss) {
146+ std::cout << tp << std::endl;
147+ std::cout << abbrev << std::endl;
148+ } else {
149+ std::cout << "解析失敗" << std::endl;
150+ }
148151 }
149152}
150153```
151154* chrono::from_stream[color ff0000]
152155
153- #### 出力例
156+ #### 出力
154157```
155- 2019-10-24 11 :15:27 GPS
156- 2019-10-24 11 :15:27 GPS
158+ 2019-10-24 20 :15:45
159+ 2019-10-24 20 :15:45
157160GPS
158161```
159162
@@ -168,7 +171,7 @@ namespace chrono = std::chrono;
168171int main()
169172{
170173 chrono::gps_clock::time_point now = chrono::gps_clock::now();
171- chrono::gps_seconds now_sec = chrono::floor<chrono::seconds>(tp );
174+ chrono::gps_seconds now_sec = chrono::floor<chrono::seconds>(now );
172175
173176 // デフォルトフォーマット
174177 std::cout << std::format("1 : {}", now_sec) << std::endl;
@@ -177,25 +180,25 @@ int main()
177180 std::cout << std::format("2 : {:%Y年%m月%d日 %H時%M分%S秒}", now_sec) << std::endl;
178181
179182 // 日付を / (スラッシュ) 区切り、時間を : (コロン) 区切り、タイムゾーンの略称付き
180- std::cout << std::format("3 : {0 :%Y/%m/%d %H:%M:%S %Z}", now_sec) << std::endl;
183+ std::cout << std::format("3 : {:%Y/%m/%d %H:%M:%S %Z}", now_sec) << std::endl;
181184
182185 // 日付だけ出力
183- std::cout << std::format("4 : %Y年%m月%d日", now_sec) << std::endl;
184- std::cout << std::format("5 : %F ", now_sec) << std::endl;
186+ std::cout << std::format("4 : {: %Y年%m月%d日} ", now_sec) << std::endl;
187+ std::cout << std::format("5 : {:%F} ", now_sec) << std::endl;
185188
186189 // 時間だけ出力
187- std::cout << std::format("6 : %H時%M分%S秒", now_sec) << std::endl;
188- std::cout << std::format("7 : %T ", now_sec) << std::endl;
190+ std::cout << std::format("6 : {: %H時%M分%S秒} ", now_sec) << std::endl;
191+ std::cout << std::format("7 : {:%T} ", now_sec) << std::endl;
189192}
190193```
191194* chrono::gps_clock[ link gps_clock.md]
192195* now()[ link gps_clock/now.md]
193196* chrono::floor[ link time_point/floor.md]
194197* std::format[ link format.md]
195198
196- #### 出力例
199+ #### 出力
197200```
198- 1 : 2019-12-20 10:05:05 GPS
201+ 1 : 2019-12-20 10:05:05
1992022 : 2019年12月20日 10時05分05秒
2002033 : 2019/12/20 10:05:05 GPS
2012044 : 2019年12月20日
@@ -204,13 +207,14 @@ int main()
2042077 : 10:05:05
205208```
206209
210+
207211## バージョン
208212### 言語
209213- C++20
210214
211215### 処理系
212216- [ Clang] ( /implementation.md#clang ) : 9.0 [ mark noimpl]
213- - [ GCC] ( /implementation.md#gcc ) : 9.2 [ mark noimpl]
217+ - [ GCC] ( /implementation.md#gcc ) : 9.2 [ mark noimpl] , 14.1 [ mark verified ]
214218- [ Visual C++] ( /implementation.md#visual_cpp ) : 2019 Update 3 [ mark noimpl]
215219
216220
0 commit comments