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