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