xref: /aosp_15_r20/external/cronet/third_party/libc++/src/modules/std/chrono.cppm (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10module;
11#include <chrono>
12
13export module std:chrono;
14export namespace std {
15
16  namespace chrono {
17    using std::chrono::duration;
18    using std::chrono::time_point;
19
20  } // namespace chrono
21
22  using std::common_type;
23
24  namespace chrono {
25
26    // [time.traits], customization traits
27    using std::chrono::treat_as_floating_point;
28    using std::chrono::treat_as_floating_point_v;
29
30    using std::chrono::duration_values;
31
32    // using std::chrono::is_clock;
33    // using std::chrono::is_clock_v;
34
35    // [time.duration.nonmember], duration arithmetic
36    using std::chrono::operator+;
37    using std::chrono::operator-;
38    using std::chrono::operator*;
39    using std::chrono::operator/;
40    using std::chrono::operator%;
41
42    // [time.duration.comparisons], duration comparisons
43    using std::chrono::operator==;
44    using std::chrono::operator!=;
45    using std::chrono::operator<;
46    using std::chrono::operator>;
47    using std::chrono::operator<=;
48    using std::chrono::operator>=;
49    using std::chrono::operator<=>;
50
51    // [time.duration.cast], conversions
52    using std::chrono::ceil;
53    using std::chrono::duration_cast;
54    using std::chrono::floor;
55    using std::chrono::round;
56
57    // [time.duration.io], duration I/O
58#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
59    using std::chrono::operator<<;
60#endif
61    // using std::chrono::from_stream;
62
63    // convenience typedefs
64    using std::chrono::days;
65    using std::chrono::hours;
66    using std::chrono::microseconds;
67    using std::chrono::milliseconds;
68    using std::chrono::minutes;
69    using std::chrono::months;
70    using std::chrono::nanoseconds;
71    using std::chrono::seconds;
72    using std::chrono::weeks;
73    using std::chrono::years;
74
75    // [time.point.nonmember], time_point arithmetic
76
77    // [time.point.comparisons], time_point comparisons
78
79    // [time.point.cast], conversions
80    using std::chrono::time_point_cast;
81
82    // [time.duration.alg], specialized algorithms
83    using std::chrono::abs;
84
85    // [time.clock.system], class system_clock
86    using std::chrono::system_clock;
87
88    using std::chrono::sys_days;
89    using std::chrono::sys_seconds;
90    using std::chrono::sys_time;
91
92#if 0
93    // [time.clock.utc], class utc_clock
94    using std::chrono::utc_clock;
95
96    using std::chrono::utc_seconds;
97    using std::chrono::utc_time;
98
99    using std::chrono::leap_second_info;
100
101    using std::chrono::get_leap_second_info;
102    // [time.clock.tai], class tai_clock
103    using std::chrono::tai_clock;
104
105    using std::chrono::tai_seconds;
106    using std::chrono::tai_time;
107
108    // [time.clock.gps], class gps_clock
109    using std::chrono::gps_clock;
110
111    using std::chrono::gps_seconds;
112    using std::chrono::gps_time;
113#endif
114    // [time.clock.file], type file_clock
115    using std::chrono::file_clock;
116
117    using std::chrono::file_time;
118
119    // [time.clock.steady], class steady_clock
120    using std::chrono::steady_clock;
121
122    // [time.clock.hires], class high_resolution_clock
123    using std::chrono::high_resolution_clock;
124
125    // [time.clock.local], local time
126    using std::chrono::local_days;
127    using std::chrono::local_seconds;
128    using std::chrono::local_t;
129    using std::chrono::local_time;
130
131    // [time.clock.cast], time_point conversions
132    // using std::chrono::clock_time_conversion;
133
134    // using std::chrono::clock_cast;
135
136    // [time.cal.last], class last_spec
137    using std::chrono::last_spec;
138
139    // [time.cal.day], class day
140    using std::chrono::day;
141
142    // [time.cal.month], class month
143    using std::chrono::month;
144
145    // [time.cal.year], class year
146    using std::chrono::year;
147
148    // [time.cal.wd], class weekday
149    using std::chrono::weekday;
150
151    // [time.cal.wdidx], class weekday_indexed
152    using std::chrono::weekday_indexed;
153
154    // [time.cal.wdlast], class weekday_last
155    using std::chrono::weekday_last;
156
157    // [time.cal.md], class month_day
158    using std::chrono::month_day;
159
160    // [time.cal.mdlast], class month_day_last
161    using std::chrono::month_day_last;
162
163    // [time.cal.mwd], class month_weekday
164    using std::chrono::month_weekday;
165
166    // [time.cal.mwdlast], class month_weekday_last
167    using std::chrono::month_weekday_last;
168
169    // [time.cal.ym], class year_month
170    using std::chrono::year_month;
171
172    // [time.cal.ymd], class year_month_day
173    using std::chrono::year_month_day;
174
175    // [time.cal.ymdlast], class year_month_day_last
176    using std::chrono::year_month_day_last;
177
178    // [time.cal.ymwd], class year_month_weekday
179    using std::chrono::year_month_weekday;
180
181    // [time.cal.ymwdlast], class year_month_weekday_last
182    using std::chrono::year_month_weekday_last;
183
184    // [time.cal.operators], civil calendar conventional syntax operators
185
186    // [time.hms], class template hh_mm_ss
187    using std::chrono::hh_mm_ss;
188
189    // [time.12], 12/24 hour functions
190    using std::chrono::is_am;
191    using std::chrono::is_pm;
192    using std::chrono::make12;
193    using std::chrono::make24;
194
195#if 0
196    // [time.zone.db], time zone database
197    using std::chrono::tzdb;
198    using std::chrono::tzdb_list;
199
200    // [time.zone.db.access], time zone database access
201    using std::chrono::current_zone;
202    using std::chrono::get_tzdb;
203    using std::chrono::get_tzdb_list;
204    using std::chrono::locate_zone;
205
206    // [time.zone.db.remote], remote time zone database support
207    using std::chrono::reload_tzdb;
208    using std::chrono::remote_version;
209
210    // [time.zone.exception], exception classes
211    using std::chrono::ambiguous_local_time;
212    using std::chrono::nonexistent_local_time;
213
214    // [time.zone.info], information classes
215    using std::chrono::sys_info;
216
217    // [time.zone.timezone], class time_zone
218    using std::chrono::choose;
219    using std::chrono::time_zone;
220
221    // [time.zone.zonedtraits], class template zoned_traits
222    using std::chrono::zoned_traits;
223
224    // [time.zone.zonedtime], class template zoned_time
225    using std::chrono::zoned_time;
226
227    using std::chrono::zoned_seconds;
228
229    // [time.zone.leap], leap second support
230    using std::chrono::leap_second;
231
232    // [time.zone.link], class time_zone_link
233    using std::chrono::time_zone_link;
234
235    // [time.format], formatting
236    using std::chrono::local_time_format;
237#endif
238  } // namespace chrono
239
240  using std::formatter;
241
242  namespace chrono {
243    // using std::chrono::parse;
244
245    // calendrical constants
246    using std::chrono::last;
247
248    using std::chrono::Friday;
249    using std::chrono::Monday;
250    using std::chrono::Saturday;
251    using std::chrono::Sunday;
252    using std::chrono::Thursday;
253    using std::chrono::Tuesday;
254    using std::chrono::Wednesday;
255
256    using std::chrono::April;
257    using std::chrono::August;
258    using std::chrono::December;
259    using std::chrono::February;
260    using std::chrono::January;
261    using std::chrono::July;
262    using std::chrono::June;
263    using std::chrono::March;
264    using std::chrono::May;
265    using std::chrono::November;
266    using std::chrono::October;
267    using std::chrono::September;
268
269  } // namespace chrono
270
271} // namespace std
272export namespace std::inline literals::inline chrono_literals {
273  // [time.duration.literals], suffixes for duration literals
274  using std::literals::chrono_literals::operator""h;
275  using std::literals::chrono_literals::operator""min;
276  using std::literals::chrono_literals::operator""s;
277  using std::literals::chrono_literals::operator""ms;
278  using std::literals::chrono_literals::operator""us;
279  using std::literals::chrono_literals::operator""ns;
280
281  // [using std::literals::chrono_literals::.cal.day.nonmembers], non-member functions
282  using std::literals::chrono_literals::operator""d;
283
284  // [using std::literals::chrono_literals::.cal.year.nonmembers], non-member functions
285  using std::literals::chrono_literals::operator""y;
286} // namespace std::inline literals::inline chrono_literals
287