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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Time zones <a id="time.zone">[[time.zone]]</a>
|
| 2 |
+
|
| 3 |
+
### In general <a id="time.zone.general">[[time.zone.general]]</a>
|
| 4 |
+
|
| 5 |
+
[[time.zone]] describes an interface for accessing the IANA Time Zone
|
| 6 |
+
Database that interoperates with `sys_time` and `local_time`. This
|
| 7 |
+
interface provides time zone support to both the civil calendar types
|
| 8 |
+
[[time.cal]] and to user-defined calendars.
|
| 9 |
+
|
| 10 |
+
### Time zone database <a id="time.zone.db">[[time.zone.db]]</a>
|
| 11 |
+
|
| 12 |
+
#### Class `tzdb` <a id="time.zone.db.tzdb">[[time.zone.db.tzdb]]</a>
|
| 13 |
+
|
| 14 |
+
``` cpp
|
| 15 |
+
namespace std::chrono {
|
| 16 |
+
struct tzdb {
|
| 17 |
+
string version;
|
| 18 |
+
vector<time_zone> zones;
|
| 19 |
+
vector<time_zone_link> links;
|
| 20 |
+
vector<leap_second> leap_seconds;
|
| 21 |
+
|
| 22 |
+
const time_zone* locate_zone(string_view tz_name) const;
|
| 23 |
+
const time_zone* current_zone() const;
|
| 24 |
+
};
|
| 25 |
+
}
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
Each `vector` in a `tzdb` object is sorted to enable fast lookup.
|
| 29 |
+
|
| 30 |
+
``` cpp
|
| 31 |
+
const time_zone* locate_zone(string_view tz_name) const;
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
*Returns:*
|
| 35 |
+
|
| 36 |
+
- If `zones` contains an element `tz` for which `tz.name() == tz_name`,
|
| 37 |
+
a pointer to `tz`;
|
| 38 |
+
- otherwise, if `links` contains an element `tz_l` for which
|
| 39 |
+
`tz_l.name() == tz_name`, then a pointer to the element `tz` of
|
| 40 |
+
`zones` for which `tz.name() == tz_l.target()`.
|
| 41 |
+
|
| 42 |
+
[*Note 1*: A `time_zone_link` specifies an alternative name for a
|
| 43 |
+
`time_zone`. — *end note*]
|
| 44 |
+
|
| 45 |
+
*Throws:* If a `const time_zone*` cannot be found as described in the
|
| 46 |
+
*Returns:* clause, throws a `runtime_error`.
|
| 47 |
+
|
| 48 |
+
[*Note 2*: On non-exceptional return, the return value is always a
|
| 49 |
+
pointer to a valid `time_zone`. — *end note*]
|
| 50 |
+
|
| 51 |
+
``` cpp
|
| 52 |
+
const time_zone* current_zone() const;
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
*Returns:* A pointer to the time zone which the computer has set as its
|
| 56 |
+
local time zone.
|
| 57 |
+
|
| 58 |
+
#### Class `tzdb_list` <a id="time.zone.db.list">[[time.zone.db.list]]</a>
|
| 59 |
+
|
| 60 |
+
``` cpp
|
| 61 |
+
namespace std::chrono {
|
| 62 |
+
class tzdb_list {
|
| 63 |
+
public:
|
| 64 |
+
tzdb_list(const tzdb_list&) = delete;
|
| 65 |
+
tzdb_list& operator=(const tzdb_list&) = delete;
|
| 66 |
+
|
| 67 |
+
// unspecified additional constructors
|
| 68 |
+
|
| 69 |
+
class const_iterator;
|
| 70 |
+
|
| 71 |
+
const tzdb& front() const noexcept;
|
| 72 |
+
|
| 73 |
+
const_iterator erase_after(const_iterator p);
|
| 74 |
+
|
| 75 |
+
const_iterator begin() const noexcept;
|
| 76 |
+
const_iterator end() const noexcept;
|
| 77 |
+
|
| 78 |
+
const_iterator cbegin() const noexcept;
|
| 79 |
+
const_iterator cend() const noexcept;
|
| 80 |
+
};
|
| 81 |
+
}
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
The `tzdb_list` database is a singleton; the unique object of type
|
| 85 |
+
`tzdb_list` can be accessed via the `get_tzdb_list()` function.
|
| 86 |
+
|
| 87 |
+
[*Note 1*: This access is only needed for those applications that need
|
| 88 |
+
to have long uptimes and have a need to update the time zone database
|
| 89 |
+
while running. Other applications can implicitly access the `front()` of
|
| 90 |
+
this list via the read-only namespace scope functions `get_tzdb()`,
|
| 91 |
+
`locate_zone()`, and `current_zone()`. — *end note*]
|
| 92 |
+
|
| 93 |
+
The `tzdb_list` object contains a list of `tzdb` objects.
|
| 94 |
+
|
| 95 |
+
`tzdb_list::const_iterator` is a constant iterator which meets the
|
| 96 |
+
*Cpp17ForwardIterator* requirements and has a value type of `tzdb`.
|
| 97 |
+
|
| 98 |
+
``` cpp
|
| 99 |
+
const tzdb& front() const noexcept;
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
*Synchronization:* This operation is thread-safe with respect to
|
| 103 |
+
`reload_tzdb()`.
|
| 104 |
+
|
| 105 |
+
[*Note 1*: `reload_tzdb()` pushes a new `tzdb` onto the front of this
|
| 106 |
+
container. — *end note*]
|
| 107 |
+
|
| 108 |
+
*Returns:* A reference to the first `tzdb` in the container.
|
| 109 |
+
|
| 110 |
+
``` cpp
|
| 111 |
+
const_iterator erase_after(const_iterator p);
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
*Preconditions:* The iterator following `p` is dereferenceable.
|
| 115 |
+
|
| 116 |
+
*Effects:* Erases the `tzdb` referred to by the iterator following `p`.
|
| 117 |
+
|
| 118 |
+
*Returns:* An iterator pointing to the element following the one that
|
| 119 |
+
was erased, or `end()` if no such element exists.
|
| 120 |
+
|
| 121 |
+
*Ensures:* No pointers, references, or iterators are invalidated except
|
| 122 |
+
those referring to the erased `tzdb`.
|
| 123 |
+
|
| 124 |
+
[*Note 2*: It is not possible to erase the `tzdb` referred to by
|
| 125 |
+
`begin()`. — *end note*]
|
| 126 |
+
|
| 127 |
+
*Throws:* Nothing.
|
| 128 |
+
|
| 129 |
+
``` cpp
|
| 130 |
+
const_iterator begin() const noexcept;
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
*Returns:* An iterator referring to the first `tzdb` in the container.
|
| 134 |
+
|
| 135 |
+
``` cpp
|
| 136 |
+
const_iterator end() const noexcept;
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
*Returns:* An iterator referring to the position one past the last
|
| 140 |
+
`tzdb` in the container.
|
| 141 |
+
|
| 142 |
+
``` cpp
|
| 143 |
+
const_iterator cbegin() const noexcept;
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
*Returns:* `begin()`.
|
| 147 |
+
|
| 148 |
+
``` cpp
|
| 149 |
+
const_iterator cend() const noexcept;
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
*Returns:* `end()`.
|
| 153 |
+
|
| 154 |
+
#### Time zone database access <a id="time.zone.db.access">[[time.zone.db.access]]</a>
|
| 155 |
+
|
| 156 |
+
``` cpp
|
| 157 |
+
tzdb_list& get_tzdb_list();
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
*Effects:* If this is the first access to the time zone database,
|
| 161 |
+
initializes the database. If this call initializes the database, the
|
| 162 |
+
resulting database will be a `tzdb_list` holding a single initialized
|
| 163 |
+
`tzdb`.
|
| 164 |
+
|
| 165 |
+
*Synchronization:* It is safe to call this function from multiple
|
| 166 |
+
threads at one time.
|
| 167 |
+
|
| 168 |
+
*Returns:* A reference to the database.
|
| 169 |
+
|
| 170 |
+
*Throws:* `runtime_error` if for any reason a reference cannot be
|
| 171 |
+
returned to a valid `tzdb_list` containing one or more valid `tzdb`s.
|
| 172 |
+
|
| 173 |
+
``` cpp
|
| 174 |
+
const tzdb& get_tzdb();
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
*Returns:* `get_tzdb_list().front()`.
|
| 178 |
+
|
| 179 |
+
``` cpp
|
| 180 |
+
const time_zone* locate_zone(string_view tz_name);
|
| 181 |
+
```
|
| 182 |
+
|
| 183 |
+
*Returns:* `get_tzdb().locate_zone(tz_name)`.
|
| 184 |
+
|
| 185 |
+
[*Note 1*: The time zone database will be initialized if this is the
|
| 186 |
+
first reference to the database. — *end note*]
|
| 187 |
+
|
| 188 |
+
``` cpp
|
| 189 |
+
const time_zone* current_zone();
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
*Returns:* `get_tzdb().current_zone()`.
|
| 193 |
+
|
| 194 |
+
#### Remote time zone database support <a id="time.zone.db.remote">[[time.zone.db.remote]]</a>
|
| 195 |
+
|
| 196 |
+
The local time zone database is that supplied by the implementation when
|
| 197 |
+
the program first accesses the database, for example via
|
| 198 |
+
`current_zone()`. While the program is running, the implementation may
|
| 199 |
+
choose to update the time zone database. This update shall not impact
|
| 200 |
+
the program in any way unless the program calls the functions in this
|
| 201 |
+
subclause. This potentially updated time zone database is referred to as
|
| 202 |
+
the *remote time zone database*.
|
| 203 |
+
|
| 204 |
+
``` cpp
|
| 205 |
+
const tzdb& reload_tzdb();
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
*Effects:* This function first checks the version of the remote time
|
| 209 |
+
zone database. If the versions of the local and remote databases are the
|
| 210 |
+
same, there are no effects. Otherwise the remote database is pushed to
|
| 211 |
+
the front of the `tzdb_list` accessed by `get_tzdb_list()`.
|
| 212 |
+
|
| 213 |
+
*Synchronization:* This function is thread-safe with respect to
|
| 214 |
+
`get_tzdb_list().front()` and `get_tzdb_list().erase_after()`.
|
| 215 |
+
|
| 216 |
+
*Ensures:* No pointers, references, or iterators are invalidated.
|
| 217 |
+
|
| 218 |
+
*Returns:* `get_tzdb_list().front()`.
|
| 219 |
+
|
| 220 |
+
*Throws:* `runtime_error` if for any reason a reference cannot be
|
| 221 |
+
returned to a valid `tzdb`.
|
| 222 |
+
|
| 223 |
+
``` cpp
|
| 224 |
+
string remote_version();
|
| 225 |
+
```
|
| 226 |
+
|
| 227 |
+
*Returns:* The latest remote database version.
|
| 228 |
+
|
| 229 |
+
[*Note 1*: This can be compared with `get_tzdb().version` to discover
|
| 230 |
+
if the local and remote databases are equivalent. — *end note*]
|
| 231 |
+
|
| 232 |
+
### Exception classes <a id="time.zone.exception">[[time.zone.exception]]</a>
|
| 233 |
+
|
| 234 |
+
#### Class `nonexistent_local_time` <a id="time.zone.exception.nonexist">[[time.zone.exception.nonexist]]</a>
|
| 235 |
+
|
| 236 |
+
``` cpp
|
| 237 |
+
namespace std::chrono {
|
| 238 |
+
class nonexistent_local_time : public runtime_error {
|
| 239 |
+
public:
|
| 240 |
+
template<class Duration>
|
| 241 |
+
nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
|
| 242 |
+
};
|
| 243 |
+
}
|
| 244 |
+
```
|
| 245 |
+
|
| 246 |
+
`nonexistent_local_time` is thrown when an attempt is made to convert a
|
| 247 |
+
non-existent `local_time` to a `sys_time` without specifying
|
| 248 |
+
`choose::earliest` or `choose::latest`.
|
| 249 |
+
|
| 250 |
+
``` cpp
|
| 251 |
+
template<class Duration>
|
| 252 |
+
nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
*Preconditions:* `i.result == local_info::nonexistent` is `true`.
|
| 256 |
+
|
| 257 |
+
*Effects:* Initializes the base class with a sequence of `char`
|
| 258 |
+
equivalent to that produced by `os.str()` initialized as shown below:
|
| 259 |
+
|
| 260 |
+
``` cpp
|
| 261 |
+
ostringstream os;
|
| 262 |
+
os << tp << " is in a gap between\n"
|
| 263 |
+
<< local_seconds{i.first.end.time_since_epoch()} + i.first.offset << ' '
|
| 264 |
+
<< i.first.abbrev << " and\n"
|
| 265 |
+
<< local_seconds{i.second.begin.time_since_epoch()} + i.second.offset << ' '
|
| 266 |
+
<< i.second.abbrev
|
| 267 |
+
<< " which are both equivalent to\n"
|
| 268 |
+
<< i.first.end << " UTC";
|
| 269 |
+
```
|
| 270 |
+
|
| 271 |
+
[*Example 1*:
|
| 272 |
+
|
| 273 |
+
``` cpp
|
| 274 |
+
#include <chrono>
|
| 275 |
+
#include <iostream>
|
| 276 |
+
|
| 277 |
+
int main() {
|
| 278 |
+
using namespace std::chrono;
|
| 279 |
+
try {
|
| 280 |
+
auto zt = zoned_time{"America/New_York",
|
| 281 |
+
local_days{Sunday[2]/March/2016} + 2h + 30min};
|
| 282 |
+
} catch (const nonexistent_local_time& e) {
|
| 283 |
+
std::cout << e.what() << '\n';
|
| 284 |
+
}
|
| 285 |
+
}
|
| 286 |
+
```
|
| 287 |
+
|
| 288 |
+
Produces the output:
|
| 289 |
+
|
| 290 |
+
``` text
|
| 291 |
+
2016-03-13 02:30:00 is in a gap between
|
| 292 |
+
2016-03-13 02:00:00 EST and
|
| 293 |
+
2016-03-13 03:00:00 EDT which are both equivalent to
|
| 294 |
+
2016-03-13 07:00:00 UTC
|
| 295 |
+
```
|
| 296 |
+
|
| 297 |
+
— *end example*]
|
| 298 |
+
|
| 299 |
+
#### Class `ambiguous_local_time` <a id="time.zone.exception.ambig">[[time.zone.exception.ambig]]</a>
|
| 300 |
+
|
| 301 |
+
``` cpp
|
| 302 |
+
namespace std::chrono {
|
| 303 |
+
class ambiguous_local_time : public runtime_error {
|
| 304 |
+
public:
|
| 305 |
+
template<class Duration>
|
| 306 |
+
ambiguous_local_time(const local_time<Duration>& tp, const local_info& i);
|
| 307 |
+
};
|
| 308 |
+
}
|
| 309 |
+
```
|
| 310 |
+
|
| 311 |
+
`ambiguous_local_time` is thrown when an attempt is made to convert an
|
| 312 |
+
ambiguous `local_time` to a `sys_time` without specifying
|
| 313 |
+
`choose::earliest` or `choose::latest`.
|
| 314 |
+
|
| 315 |
+
``` cpp
|
| 316 |
+
template<class Duration>
|
| 317 |
+
ambiguous_local_time(const local_time<Duration>& tp, const local_info& i);
|
| 318 |
+
```
|
| 319 |
+
|
| 320 |
+
*Preconditions:* `i.result == local_info::ambiguous` is `true`.
|
| 321 |
+
|
| 322 |
+
*Effects:* Initializes the base class with a sequence of `char`
|
| 323 |
+
equivalent to that produced by `os.str()` initialized as shown below:
|
| 324 |
+
|
| 325 |
+
``` cpp
|
| 326 |
+
ostringstream os;
|
| 327 |
+
os << tp << " is ambiguous. It could be\n"
|
| 328 |
+
<< tp << ' ' << i.first.abbrev << " == "
|
| 329 |
+
<< tp - i.first.offset << " UTC or\n"
|
| 330 |
+
<< tp << ' ' << i.second.abbrev << " == "
|
| 331 |
+
<< tp - i.second.offset << " UTC";
|
| 332 |
+
```
|
| 333 |
+
|
| 334 |
+
[*Example 1*:
|
| 335 |
+
|
| 336 |
+
``` cpp
|
| 337 |
+
#include <chrono>
|
| 338 |
+
#include <iostream>
|
| 339 |
+
|
| 340 |
+
int main() {
|
| 341 |
+
using namespace std::chrono;
|
| 342 |
+
try {
|
| 343 |
+
auto zt = zoned_time{"America/New_York",
|
| 344 |
+
local_days{Sunday[1]/November/2016} + 1h + 30min};
|
| 345 |
+
} catch (const ambiguous_local_time& e) {
|
| 346 |
+
std::cout << e.what() << '\n';
|
| 347 |
+
}
|
| 348 |
+
}
|
| 349 |
+
```
|
| 350 |
+
|
| 351 |
+
Produces the output:
|
| 352 |
+
|
| 353 |
+
``` text
|
| 354 |
+
2016-11-06 01:30:00 is ambiguous. It could be
|
| 355 |
+
2016-11-06 01:30:00 EDT == 2016-11-06 05:30:00 UTC or
|
| 356 |
+
2016-11-06 01:30:00 EST == 2016-11-06 06:30:00 UTC
|
| 357 |
+
```
|
| 358 |
+
|
| 359 |
+
— *end example*]
|
| 360 |
+
|
| 361 |
+
### Information classes <a id="time.zone.info">[[time.zone.info]]</a>
|
| 362 |
+
|
| 363 |
+
#### Class `sys_info` <a id="time.zone.info.sys">[[time.zone.info.sys]]</a>
|
| 364 |
+
|
| 365 |
+
``` cpp
|
| 366 |
+
namespace std::chrono {
|
| 367 |
+
struct sys_info {
|
| 368 |
+
sys_seconds begin;
|
| 369 |
+
sys_seconds end;
|
| 370 |
+
seconds offset;
|
| 371 |
+
minutes save;
|
| 372 |
+
string abbrev;
|
| 373 |
+
};
|
| 374 |
+
}
|
| 375 |
+
```
|
| 376 |
+
|
| 377 |
+
A `sys_info` object can be obtained from the combination of a
|
| 378 |
+
`time_zone` and either a `sys_time` or `local_time`. It can also be
|
| 379 |
+
obtained from a `zoned_time`, which is effectively a pair of a
|
| 380 |
+
`time_zone` and `sys_time`.
|
| 381 |
+
|
| 382 |
+
[*Note 1*: This type provides a low-level interface to time zone
|
| 383 |
+
information. Typical conversions from `sys_time` to `local_time` will
|
| 384 |
+
use this class implicitly, not explicitly. — *end note*]
|
| 385 |
+
|
| 386 |
+
The `begin` and `end` data members indicate that, for the associated
|
| 387 |
+
`time_zone` and `time_point`, the `offset` and `abbrev` are in effect in
|
| 388 |
+
the range \[`begin`, `end`). This information can be used to efficiently
|
| 389 |
+
iterate the transitions of a `time_zone`.
|
| 390 |
+
|
| 391 |
+
The `offset` data member indicates the UTC offset in effect for the
|
| 392 |
+
associated `time_zone` and `time_point`. The relationship between
|
| 393 |
+
`local_time` and `sys_time` is:
|
| 394 |
+
|
| 395 |
+
``` cpp
|
| 396 |
+
offset = local_time - sys_time
|
| 397 |
+
```
|
| 398 |
+
|
| 399 |
+
The `save` data member is extra information not normally needed for
|
| 400 |
+
conversion between `local_time` and `sys_time`. If `save != 0min`, this
|
| 401 |
+
`sys_info` is said to be on “daylight saving” time, and `offset - save`
|
| 402 |
+
suggests what offset this `time_zone` might use if it were off daylight
|
| 403 |
+
saving time. However, this information should not be taken as
|
| 404 |
+
authoritative. The only sure way to get such information is to query the
|
| 405 |
+
`time_zone` with a `time_point` that returns a `sys_info` where
|
| 406 |
+
`save == 0min`. There is no guarantee what `time_point` might return
|
| 407 |
+
such a `sys_info` except that it is guaranteed not to be in the range
|
| 408 |
+
\[`begin`, `end`) (if `save != 0min` for this `sys_info`).
|
| 409 |
+
|
| 410 |
+
The `abbrev` data member indicates the current abbreviation used for the
|
| 411 |
+
associated `time_zone` and `time_point`. Abbreviations are not unique
|
| 412 |
+
among the `time_zones`, and so one cannot reliably map abbreviations
|
| 413 |
+
back to a `time_zone` and UTC offset.
|
| 414 |
+
|
| 415 |
+
``` cpp
|
| 416 |
+
template<class charT, class traits>
|
| 417 |
+
basic_ostream<charT, traits>&
|
| 418 |
+
operator<<(basic_ostream<charT, traits>& os, const sys_info& r);
|
| 419 |
+
```
|
| 420 |
+
|
| 421 |
+
*Effects:* Streams out the `sys_info` object `r` in an unspecified
|
| 422 |
+
format.
|
| 423 |
+
|
| 424 |
+
*Returns:* `os`.
|
| 425 |
+
|
| 426 |
+
#### Class `local_info` <a id="time.zone.info.local">[[time.zone.info.local]]</a>
|
| 427 |
+
|
| 428 |
+
``` cpp
|
| 429 |
+
namespace std::chrono {
|
| 430 |
+
struct local_info {
|
| 431 |
+
static constexpr int unique = 0;
|
| 432 |
+
static constexpr int nonexistent = 1;
|
| 433 |
+
static constexpr int ambiguous = 2;
|
| 434 |
+
|
| 435 |
+
int result;
|
| 436 |
+
sys_info first;
|
| 437 |
+
sys_info second;
|
| 438 |
+
};
|
| 439 |
+
}
|
| 440 |
+
```
|
| 441 |
+
|
| 442 |
+
[*Note 1*: This type provides a low-level interface to time zone
|
| 443 |
+
information. Typical conversions from `local_time` to `sys_time` will
|
| 444 |
+
use this class implicitly, not explicitly. — *end note*]
|
| 445 |
+
|
| 446 |
+
Describes the result of converting a `local_time` to a `sys_time` as
|
| 447 |
+
follows:
|
| 448 |
+
|
| 449 |
+
- When a `local_time` to `sys_time` conversion is unique,
|
| 450 |
+
`result == unique`, `first` will be filled out with the correct
|
| 451 |
+
`sys_info`, and `second` will be zero-initialized.
|
| 452 |
+
- If the conversion stems from a nonexistent `local_time` then
|
| 453 |
+
`result == nonexistent`, `first` will be filled out with the
|
| 454 |
+
`sys_info` that ends just prior to the `local_time`, and `second` will
|
| 455 |
+
be filled out with the `sys_info` that begins just after the
|
| 456 |
+
`local_time`.
|
| 457 |
+
- If the conversion stems from an ambiguous `local_time`, then
|
| 458 |
+
`result == ambiguous`, `first` will be filled out with the `sys_info`
|
| 459 |
+
that ends just after the `local_time`, and `second` will be filled out
|
| 460 |
+
with the `sys_info` that starts just before the `local_time`.
|
| 461 |
+
|
| 462 |
+
``` cpp
|
| 463 |
+
template<class charT, class traits>
|
| 464 |
+
basic_ostream<charT, traits>&
|
| 465 |
+
operator<<(basic_ostream<charT, traits>& os, const local_info& r);
|
| 466 |
+
```
|
| 467 |
+
|
| 468 |
+
*Effects:* Streams out the `local_info` object `r` in an unspecified
|
| 469 |
+
format.
|
| 470 |
+
|
| 471 |
+
*Returns:* `os`.
|
| 472 |
+
|
| 473 |
+
### Class `time_zone` <a id="time.zone.timezone">[[time.zone.timezone]]</a>
|
| 474 |
+
|
| 475 |
+
#### Overview <a id="time.zone.overview">[[time.zone.overview]]</a>
|
| 476 |
+
|
| 477 |
+
``` cpp
|
| 478 |
+
namespace std::chrono {
|
| 479 |
+
class time_zone {
|
| 480 |
+
public:
|
| 481 |
+
time_zone(time_zone&&) = default;
|
| 482 |
+
time_zone& operator=(time_zone&&) = default;
|
| 483 |
+
|
| 484 |
+
// unspecified additional constructors
|
| 485 |
+
|
| 486 |
+
string_view name() const noexcept;
|
| 487 |
+
|
| 488 |
+
template<class Duration> sys_info get_info(const sys_time<Duration>& st) const;
|
| 489 |
+
template<class Duration> local_info get_info(const local_time<Duration>& tp) const;
|
| 490 |
+
|
| 491 |
+
template<class Duration>
|
| 492 |
+
sys_time<common_type_t<Duration, seconds>>
|
| 493 |
+
to_sys(const local_time<Duration>& tp) const;
|
| 494 |
+
|
| 495 |
+
template<class Duration>
|
| 496 |
+
sys_time<common_type_t<Duration, seconds>>
|
| 497 |
+
to_sys(const local_time<Duration>& tp, choose z) const;
|
| 498 |
+
|
| 499 |
+
template<class Duration>
|
| 500 |
+
local_time<common_type_t<Duration, seconds>>
|
| 501 |
+
to_local(const sys_time<Duration>& tp) const;
|
| 502 |
+
};
|
| 503 |
+
}
|
| 504 |
+
```
|
| 505 |
+
|
| 506 |
+
A `time_zone` represents all time zone transitions for a specific
|
| 507 |
+
geographic area. `time_zone` construction is unspecified, and performed
|
| 508 |
+
as part of database initialization.
|
| 509 |
+
|
| 510 |
+
[*Note 1*: `const time_zone` objects can be accessed via functions such
|
| 511 |
+
as `locate_zone`. — *end note*]
|
| 512 |
+
|
| 513 |
+
#### Member functions <a id="time.zone.members">[[time.zone.members]]</a>
|
| 514 |
+
|
| 515 |
+
``` cpp
|
| 516 |
+
string_view name() const noexcept;
|
| 517 |
+
```
|
| 518 |
+
|
| 519 |
+
*Returns:* The name of the `time_zone`.
|
| 520 |
+
|
| 521 |
+
[*Example 1*: `"America/New_York"`. — *end example*]
|
| 522 |
+
|
| 523 |
+
``` cpp
|
| 524 |
+
template<class Duration>
|
| 525 |
+
sys_info get_info(const sys_time<Duration>& st) const;
|
| 526 |
+
```
|
| 527 |
+
|
| 528 |
+
*Returns:* A `sys_info` `i` for which `st` is in the range \[`i.begin`,
|
| 529 |
+
`i.end`).
|
| 530 |
+
|
| 531 |
+
``` cpp
|
| 532 |
+
template<class Duration>
|
| 533 |
+
local_info get_info(const local_time<Duration>& tp) const;
|
| 534 |
+
```
|
| 535 |
+
|
| 536 |
+
*Returns:* A `local_info` for `tp`.
|
| 537 |
+
|
| 538 |
+
``` cpp
|
| 539 |
+
template<class Duration>
|
| 540 |
+
sys_time<common_type_t<Duration, seconds>>
|
| 541 |
+
to_sys(const local_time<Duration>& tp) const;
|
| 542 |
+
```
|
| 543 |
+
|
| 544 |
+
*Returns:* A `sys_time` that is at least as fine as `seconds`, and will
|
| 545 |
+
be finer if the argument `tp` has finer precision. This `sys_time` is
|
| 546 |
+
the UTC equivalent of `tp` according to the rules of this `time_zone`.
|
| 547 |
+
|
| 548 |
+
*Throws:* If the conversion from `tp` to a `sys_time` is ambiguous,
|
| 549 |
+
throws `ambiguous_local_time`. If the `tp` represents a non-existent
|
| 550 |
+
time between two UTC `time_points`, throws `nonexistent_local_time`.
|
| 551 |
+
|
| 552 |
+
``` cpp
|
| 553 |
+
template<class Duration>
|
| 554 |
+
sys_time<common_type_t<Duration, seconds>>
|
| 555 |
+
to_sys(const local_time<Duration>& tp, choose z) const;
|
| 556 |
+
```
|
| 557 |
+
|
| 558 |
+
*Returns:* A `sys_time` that is at least as fine as `seconds`, and will
|
| 559 |
+
be finer if the argument `tp` has finer precision. This `sys_time` is
|
| 560 |
+
the UTC equivalent of `tp` according to the rules of this `time_zone`.
|
| 561 |
+
If the conversion from `tp` to a `sys_time` is ambiguous, returns the
|
| 562 |
+
earlier `sys_time` if `z == choose::earliest`, and returns the later
|
| 563 |
+
`sys_time` if `z == choose::latest`. If the `tp` represents a
|
| 564 |
+
non-existent time between two UTC `time_points`, then the two UTC
|
| 565 |
+
`time_points` will be the same, and that UTC `time_point` will be
|
| 566 |
+
returned.
|
| 567 |
+
|
| 568 |
+
``` cpp
|
| 569 |
+
template<class Duration>
|
| 570 |
+
local_time<common_type_t<Duration, seconds>>
|
| 571 |
+
to_local(const sys_time<Duration>& tp) const;
|
| 572 |
+
```
|
| 573 |
+
|
| 574 |
+
*Returns:* The `local_time` associated with `tp` and this `time_zone`.
|
| 575 |
+
|
| 576 |
+
#### Non-member functions <a id="time.zone.nonmembers">[[time.zone.nonmembers]]</a>
|
| 577 |
+
|
| 578 |
+
``` cpp
|
| 579 |
+
bool operator==(const time_zone& x, const time_zone& y) noexcept;
|
| 580 |
+
```
|
| 581 |
+
|
| 582 |
+
*Returns:* `x.name() == y.name()`.
|
| 583 |
+
|
| 584 |
+
``` cpp
|
| 585 |
+
strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept;
|
| 586 |
+
```
|
| 587 |
+
|
| 588 |
+
*Returns:* `x.name() <=> y.name()`.
|
| 589 |
+
|
| 590 |
+
### Class template `zoned_traits` <a id="time.zone.zonedtraits">[[time.zone.zonedtraits]]</a>
|
| 591 |
+
|
| 592 |
+
``` cpp
|
| 593 |
+
namespace std::chrono {
|
| 594 |
+
template<class T> struct zoned_traits {};
|
| 595 |
+
}
|
| 596 |
+
```
|
| 597 |
+
|
| 598 |
+
`zoned_traits` provides a means for customizing the behavior of
|
| 599 |
+
`zoned_time<Duration, TimeZonePtr>` for the `zoned_time` default
|
| 600 |
+
constructor, and constructors taking `string_view`. A specialization for
|
| 601 |
+
`const time_zone*` is provided by the implementation:
|
| 602 |
+
|
| 603 |
+
``` cpp
|
| 604 |
+
namespace std::chrono {
|
| 605 |
+
template<> struct zoned_traits<const time_zone*> {
|
| 606 |
+
static const time_zone* default_zone();
|
| 607 |
+
static const time_zone* locate_zone(string_view name);
|
| 608 |
+
};
|
| 609 |
+
}
|
| 610 |
+
```
|
| 611 |
+
|
| 612 |
+
``` cpp
|
| 613 |
+
static const time_zone* default_zone();
|
| 614 |
+
```
|
| 615 |
+
|
| 616 |
+
*Returns:* `std::chrono::locate_zone("UTC")`.
|
| 617 |
+
|
| 618 |
+
``` cpp
|
| 619 |
+
static const time_zone* locate_zone(string_view name);
|
| 620 |
+
```
|
| 621 |
+
|
| 622 |
+
*Returns:* `std::chrono::locate_zone(name)`.
|
| 623 |
+
|
| 624 |
+
### Class template `zoned_time` <a id="time.zone.zonedtime">[[time.zone.zonedtime]]</a>
|
| 625 |
+
|
| 626 |
+
#### Overview <a id="time.zone.zonedtime.overview">[[time.zone.zonedtime.overview]]</a>
|
| 627 |
+
|
| 628 |
+
``` cpp
|
| 629 |
+
namespace std::chrono {
|
| 630 |
+
template<class Duration, class TimeZonePtr = const time_zone*>
|
| 631 |
+
class zoned_time {
|
| 632 |
+
public:
|
| 633 |
+
using duration = common_type_t<Duration, seconds>;
|
| 634 |
+
|
| 635 |
+
private:
|
| 636 |
+
TimeZonePtr zone_; // exposition only
|
| 637 |
+
sys_time<duration> tp_; // exposition only
|
| 638 |
+
|
| 639 |
+
using traits = zoned_traits<TimeZonePtr>; // exposition only
|
| 640 |
+
|
| 641 |
+
public:
|
| 642 |
+
zoned_time();
|
| 643 |
+
zoned_time(const zoned_time&) = default;
|
| 644 |
+
zoned_time& operator=(const zoned_time&) = default;
|
| 645 |
+
|
| 646 |
+
zoned_time(const sys_time<Duration>& st);
|
| 647 |
+
explicit zoned_time(TimeZonePtr z);
|
| 648 |
+
explicit zoned_time(string_view name);
|
| 649 |
+
|
| 650 |
+
template<class Duration2>
|
| 651 |
+
zoned_time(const zoned_time<Duration2, TimeZonePtr>& zt);
|
| 652 |
+
|
| 653 |
+
zoned_time(TimeZonePtr z, const sys_time<Duration>& st);
|
| 654 |
+
zoned_time(string_view name, const sys_time<Duration>& st);
|
| 655 |
+
|
| 656 |
+
zoned_time(TimeZonePtr z, const local_time<Duration>& tp);
|
| 657 |
+
zoned_time(string_view name, const local_time<Duration>& tp);
|
| 658 |
+
zoned_time(TimeZonePtr z, const local_time<Duration>& tp, choose c);
|
| 659 |
+
zoned_time(string_view name, const local_time<Duration>& tp, choose c);
|
| 660 |
+
|
| 661 |
+
template<class Duration2, class TimeZonePtr2>
|
| 662 |
+
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& zt);
|
| 663 |
+
template<class Duration2, class TimeZonePtr2>
|
| 664 |
+
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& zt, choose);
|
| 665 |
+
|
| 666 |
+
template<class Duration2, class TimeZonePtr2>
|
| 667 |
+
zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& zt);
|
| 668 |
+
template<class Duration2, class TimeZonePtr2>
|
| 669 |
+
zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& zt, choose);
|
| 670 |
+
|
| 671 |
+
zoned_time& operator=(const sys_time<Duration>& st);
|
| 672 |
+
zoned_time& operator=(const local_time<Duration>& ut);
|
| 673 |
+
|
| 674 |
+
operator sys_time<duration>() const;
|
| 675 |
+
explicit operator local_time<duration>() const;
|
| 676 |
+
|
| 677 |
+
TimeZonePtr get_time_zone() const;
|
| 678 |
+
local_time<duration> get_local_time() const;
|
| 679 |
+
sys_time<duration> get_sys_time() const;
|
| 680 |
+
sys_info get_info() const;
|
| 681 |
+
};
|
| 682 |
+
|
| 683 |
+
zoned_time() -> zoned_time<seconds>;
|
| 684 |
+
|
| 685 |
+
template<class Duration>
|
| 686 |
+
zoned_time(sys_time<Duration>)
|
| 687 |
+
-> zoned_time<common_type_t<Duration, seconds>>;
|
| 688 |
+
|
| 689 |
+
template<class TimeZonePtrOrName>
|
| 690 |
+
using time-zone-representation = // exposition only
|
| 691 |
+
conditional_t<is_convertible_v<TimeZonePtrOrName, string_view>,
|
| 692 |
+
const time_zone*,
|
| 693 |
+
remove_cvref_t<TimeZonePtrOrName>>;
|
| 694 |
+
|
| 695 |
+
template<class TimeZonePtrOrName>
|
| 696 |
+
zoned_time(TimeZonePtrOrName&&)
|
| 697 |
+
-> zoned_time<seconds, time-zone-representation<TimeZonePtrOrName>>;
|
| 698 |
+
|
| 699 |
+
template<class TimeZonePtrOrName, class Duration>
|
| 700 |
+
zoned_time(TimeZonePtrOrName&&, sys_time<Duration>)
|
| 701 |
+
-> zoned_time<common_type_t<Duration, seconds>,
|
| 702 |
+
time-zone-representation<TimeZonePtrOrName>>;
|
| 703 |
+
|
| 704 |
+
template<class TimeZonePtrOrName, class Duration>
|
| 705 |
+
zoned_time(TimeZonePtrOrName&&, local_time<Duration>,
|
| 706 |
+
choose = choose::earliest)
|
| 707 |
+
-> zoned_time<common_type_t<Duration, seconds>,
|
| 708 |
+
time-zone-representation<TimeZonePtrOrName>>;
|
| 709 |
+
|
| 710 |
+
template<class Duration, class TimeZonePtrOrName, class TimeZonePtr2>
|
| 711 |
+
zoned_time(TimeZonePtrOrName&&, zoned_time<Duration, TimeZonePtr2>,
|
| 712 |
+
choose = choose::earliest)
|
| 713 |
+
-> zoned_time<common_type_t<Duration, seconds>,
|
| 714 |
+
time-zone-representation<TimeZonePtrOrName>>;
|
| 715 |
+
}
|
| 716 |
+
```
|
| 717 |
+
|
| 718 |
+
`zoned_time` represents a logical pairing of a `time_zone` and a
|
| 719 |
+
`time_point` with precision `Duration`. `zoned_time<Duration>` maintains
|
| 720 |
+
the invariant that it always refers to a valid time zone and represents
|
| 721 |
+
a point in time that exists and is not ambiguous in that time zone.
|
| 722 |
+
|
| 723 |
+
If `Duration` is not a specialization of `chrono::duration`, the program
|
| 724 |
+
is ill-formed.
|
| 725 |
+
|
| 726 |
+
Every constructor of `zoned_time` that accepts a `string_view` as its
|
| 727 |
+
first parameter does not participate in class template argument
|
| 728 |
+
deduction [[over.match.class.deduct]].
|
| 729 |
+
|
| 730 |
+
#### Constructors <a id="time.zone.zonedtime.ctor">[[time.zone.zonedtime.ctor]]</a>
|
| 731 |
+
|
| 732 |
+
``` cpp
|
| 733 |
+
zoned_time();
|
| 734 |
+
```
|
| 735 |
+
|
| 736 |
+
*Constraints:* `traits::default_zone()` is a well-formed expression.
|
| 737 |
+
|
| 738 |
+
*Effects:* Initializes `zone_` with `traits::default_zone()` and default
|
| 739 |
+
constructs `tp_`.
|
| 740 |
+
|
| 741 |
+
``` cpp
|
| 742 |
+
zoned_time(const sys_time<Duration>& st);
|
| 743 |
+
```
|
| 744 |
+
|
| 745 |
+
*Constraints:* `traits::default_zone()` is a well-formed expression.
|
| 746 |
+
|
| 747 |
+
*Effects:* Initializes `zone_` with `traits::default_zone()` and `tp_`
|
| 748 |
+
with `st`.
|
| 749 |
+
|
| 750 |
+
``` cpp
|
| 751 |
+
explicit zoned_time(TimeZonePtr z);
|
| 752 |
+
```
|
| 753 |
+
|
| 754 |
+
*Preconditions:* `z` refers to a time zone.
|
| 755 |
+
|
| 756 |
+
*Effects:* Initializes `zone_` with `std::move(z)` and default
|
| 757 |
+
constructs `tp_`.
|
| 758 |
+
|
| 759 |
+
``` cpp
|
| 760 |
+
explicit zoned_time(string_view name);
|
| 761 |
+
```
|
| 762 |
+
|
| 763 |
+
*Constraints:* `traits::locate_zone(string_view{})` is a well-formed
|
| 764 |
+
expression and `zoned_time` is constructible from the return type of
|
| 765 |
+
`traits::locate_zone(string_view{})`.
|
| 766 |
+
|
| 767 |
+
*Effects:* Initializes `zone_` with `traits::locate_zone(name)` and
|
| 768 |
+
default constructs `tp_`.
|
| 769 |
+
|
| 770 |
+
``` cpp
|
| 771 |
+
template<class Duration2>
|
| 772 |
+
zoned_time(const zoned_time<Duration2, TimeZonePtr>& y);
|
| 773 |
+
```
|
| 774 |
+
|
| 775 |
+
*Constraints:*
|
| 776 |
+
`is_convertible_v<sys_time<Duration2>, sys_time<Duration>>` is `true`.
|
| 777 |
+
|
| 778 |
+
*Effects:* Initializes `zone_` with `y.zone_` and `tp_` with `y.tp_`.
|
| 779 |
+
|
| 780 |
+
``` cpp
|
| 781 |
+
zoned_time(TimeZonePtr z, const sys_time<Duration>& st);
|
| 782 |
+
```
|
| 783 |
+
|
| 784 |
+
*Preconditions:* `z` refers to a time zone.
|
| 785 |
+
|
| 786 |
+
*Effects:* Initializes `zone_` with `std::move(z)` and `tp_` with `st`.
|
| 787 |
+
|
| 788 |
+
``` cpp
|
| 789 |
+
zoned_time(string_view name, const sys_time<Duration>& st);
|
| 790 |
+
```
|
| 791 |
+
|
| 792 |
+
*Constraints:* `zoned_time` is constructible from the return type of
|
| 793 |
+
`traits::locate_zone(name)` and `st`.
|
| 794 |
+
|
| 795 |
+
*Effects:* Equivalent to construction with
|
| 796 |
+
`{traits::locate_zone(name), st}`.
|
| 797 |
+
|
| 798 |
+
``` cpp
|
| 799 |
+
zoned_time(TimeZonePtr z, const local_time<Duration>& tp);
|
| 800 |
+
```
|
| 801 |
+
|
| 802 |
+
*Preconditions:* `z` refers to a time zone.
|
| 803 |
+
|
| 804 |
+
*Constraints:*
|
| 805 |
+
|
| 806 |
+
``` cpp
|
| 807 |
+
is_convertible_v<
|
| 808 |
+
decltype(declval<TimeZonePtr&>()->to_sys(local_time<Duration>{})),
|
| 809 |
+
sys_time<duration>>
|
| 810 |
+
```
|
| 811 |
+
|
| 812 |
+
is `true`.
|
| 813 |
+
|
| 814 |
+
*Effects:* Initializes `zone_` with `std::move(z)` and `tp_` with
|
| 815 |
+
`zone_->to_sys(tp)`.
|
| 816 |
+
|
| 817 |
+
``` cpp
|
| 818 |
+
zoned_time(string_view name, const local_time<Duration>& tp);
|
| 819 |
+
```
|
| 820 |
+
|
| 821 |
+
*Constraints:* `zoned_time` is constructible from the return type of
|
| 822 |
+
`traits::locate_zone(name)` and `tp`.
|
| 823 |
+
|
| 824 |
+
*Effects:* Equivalent to construction with
|
| 825 |
+
`{traits::locate_zone(name), tp}`.
|
| 826 |
+
|
| 827 |
+
``` cpp
|
| 828 |
+
zoned_time(TimeZonePtr z, const local_time<Duration>& tp, choose c);
|
| 829 |
+
```
|
| 830 |
+
|
| 831 |
+
*Preconditions:* `z` refers to a time zone.
|
| 832 |
+
|
| 833 |
+
*Constraints:*
|
| 834 |
+
|
| 835 |
+
``` cpp
|
| 836 |
+
is_convertible_v<
|
| 837 |
+
decltype(declval<TimeZonePtr&>()->to_sys(local_time<Duration>{}, choose::earliest)),
|
| 838 |
+
sys_time<duration>>
|
| 839 |
+
```
|
| 840 |
+
|
| 841 |
+
is `true`.
|
| 842 |
+
|
| 843 |
+
*Effects:* Initializes `zone_` with `std::move(z)` and `tp_` with
|
| 844 |
+
`zone_->to_sys(tp, c)`.
|
| 845 |
+
|
| 846 |
+
``` cpp
|
| 847 |
+
zoned_time(string_view name, const local_time<Duration>& tp, choose c);
|
| 848 |
+
```
|
| 849 |
+
|
| 850 |
+
*Constraints:* `zoned_time` is constructible from the return type of
|
| 851 |
+
`traits::locate_zone(name)`, `local_time<Duration>`, and `choose`.
|
| 852 |
+
|
| 853 |
+
*Effects:* Equivalent to construction with
|
| 854 |
+
`{traits::locate_zone(name), tp, c}`.
|
| 855 |
+
|
| 856 |
+
``` cpp
|
| 857 |
+
template<class Duration2, class TimeZonePtr2>
|
| 858 |
+
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y);
|
| 859 |
+
```
|
| 860 |
+
|
| 861 |
+
*Constraints:*
|
| 862 |
+
`is_convertible_v<sys_time<Duration2>, sys_time<Duration>>` is `true`.
|
| 863 |
+
|
| 864 |
+
*Preconditions:* `z` refers to a valid time zone.
|
| 865 |
+
|
| 866 |
+
*Effects:* Initializes `zone_` with `std::move(z)` and `tp_` with
|
| 867 |
+
`y.tp_`.
|
| 868 |
+
|
| 869 |
+
``` cpp
|
| 870 |
+
template<class Duration2, class TimeZonePtr2>
|
| 871 |
+
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y, choose);
|
| 872 |
+
```
|
| 873 |
+
|
| 874 |
+
*Constraints:*
|
| 875 |
+
`is_convertible_v<sys_time<Duration2>, sys_time<Duration>>` is `true`.
|
| 876 |
+
|
| 877 |
+
*Preconditions:* `z` refers to a valid time zone.
|
| 878 |
+
|
| 879 |
+
*Effects:* Equivalent to construction with `{z, y}`.
|
| 880 |
+
|
| 881 |
+
[*Note 1*: The `choose` parameter has no effect. — *end note*]
|
| 882 |
+
|
| 883 |
+
``` cpp
|
| 884 |
+
template<class Duration2, class TimeZonePtr2>
|
| 885 |
+
zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y);
|
| 886 |
+
```
|
| 887 |
+
|
| 888 |
+
*Constraints:* `zoned_time` is constructible from the return type of
|
| 889 |
+
`traits::locate_zone(name)` and the type
|
| 890 |
+
`zoned_time<Duration2, TimeZonePtr2>`.
|
| 891 |
+
|
| 892 |
+
*Effects:* Equivalent to construction with
|
| 893 |
+
`{traits::locate_zone(name), y}`.
|
| 894 |
+
|
| 895 |
+
``` cpp
|
| 896 |
+
template<class Duration2, class TimeZonePtr2>
|
| 897 |
+
zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y, choose c);
|
| 898 |
+
```
|
| 899 |
+
|
| 900 |
+
*Constraints:* `zoned_time` is constructible from the return type of
|
| 901 |
+
`traits::locate_zone(name)`, the type
|
| 902 |
+
`zoned_time<Duration2, TimeZonePtr2>`, and the type `choose`.
|
| 903 |
+
|
| 904 |
+
*Effects:* Equivalent to construction with
|
| 905 |
+
`{traits::locate_zone(name), y, c}`.
|
| 906 |
+
|
| 907 |
+
[*Note 2*: The `choose` parameter has no effect. — *end note*]
|
| 908 |
+
|
| 909 |
+
#### Member functions <a id="time.zone.zonedtime.members">[[time.zone.zonedtime.members]]</a>
|
| 910 |
+
|
| 911 |
+
``` cpp
|
| 912 |
+
zoned_time& operator=(const sys_time<Duration>& st);
|
| 913 |
+
```
|
| 914 |
+
|
| 915 |
+
*Effects:* After assignment, `get_sys_time() == st`. This assignment has
|
| 916 |
+
no effect on the return value of `get_time_zone()`.
|
| 917 |
+
|
| 918 |
+
*Returns:* `*this`.
|
| 919 |
+
|
| 920 |
+
``` cpp
|
| 921 |
+
zoned_time& operator=(const local_time<Duration>& lt);
|
| 922 |
+
```
|
| 923 |
+
|
| 924 |
+
*Effects:* After assignment, `get_local_time() == lt`. This assignment
|
| 925 |
+
has no effect on the return value of `get_time_zone()`.
|
| 926 |
+
|
| 927 |
+
*Returns:* `*this`.
|
| 928 |
+
|
| 929 |
+
``` cpp
|
| 930 |
+
operator sys_time<duration>() const;
|
| 931 |
+
```
|
| 932 |
+
|
| 933 |
+
*Returns:* `get_sys_time()`.
|
| 934 |
+
|
| 935 |
+
``` cpp
|
| 936 |
+
explicit operator local_time<duration>() const;
|
| 937 |
+
```
|
| 938 |
+
|
| 939 |
+
*Returns:* `get_local_time()`.
|
| 940 |
+
|
| 941 |
+
``` cpp
|
| 942 |
+
TimeZonePtr get_time_zone() const;
|
| 943 |
+
```
|
| 944 |
+
|
| 945 |
+
*Returns:* `zone_`.
|
| 946 |
+
|
| 947 |
+
``` cpp
|
| 948 |
+
local_time<duration> get_local_time() const;
|
| 949 |
+
```
|
| 950 |
+
|
| 951 |
+
*Returns:* `zone_->to_local(tp_)`.
|
| 952 |
+
|
| 953 |
+
``` cpp
|
| 954 |
+
sys_time<duration> get_sys_time() const;
|
| 955 |
+
```
|
| 956 |
+
|
| 957 |
+
*Returns:* `tp_`.
|
| 958 |
+
|
| 959 |
+
``` cpp
|
| 960 |
+
sys_info get_info() const;
|
| 961 |
+
```
|
| 962 |
+
|
| 963 |
+
*Returns:* `zone_->get_info(tp_)`.
|
| 964 |
+
|
| 965 |
+
#### Non-member functions <a id="time.zone.zonedtime.nonmembers">[[time.zone.zonedtime.nonmembers]]</a>
|
| 966 |
+
|
| 967 |
+
``` cpp
|
| 968 |
+
template<class Duration1, class Duration2, class TimeZonePtr>
|
| 969 |
+
bool operator==(const zoned_time<Duration1, TimeZonePtr>& x,
|
| 970 |
+
const zoned_time<Duration2, TimeZonePtr>& y);
|
| 971 |
+
```
|
| 972 |
+
|
| 973 |
+
*Returns:* `x.zone_ == y.zone_ && x.tp_ == y.tp_`.
|
| 974 |
+
|
| 975 |
+
``` cpp
|
| 976 |
+
template<class charT, class traits, class Duration, class TimeZonePtr>
|
| 977 |
+
basic_ostream<charT, traits>&
|
| 978 |
+
operator<<(basic_ostream<charT, traits>& os,
|
| 979 |
+
const zoned_time<Duration, TimeZonePtr>& t);
|
| 980 |
+
```
|
| 981 |
+
|
| 982 |
+
*Effects:* Streams the value returned from `t.get_local_time()` to `os`
|
| 983 |
+
using the format `"%F %T %Z"`.
|
| 984 |
+
|
| 985 |
+
*Returns:* `os`.
|
| 986 |
+
|
| 987 |
+
### Class `leap_second` <a id="time.zone.leap">[[time.zone.leap]]</a>
|
| 988 |
+
|
| 989 |
+
#### Overview <a id="time.zone.leap.overview">[[time.zone.leap.overview]]</a>
|
| 990 |
+
|
| 991 |
+
``` cpp
|
| 992 |
+
namespace std::chrono {
|
| 993 |
+
class leap_second {
|
| 994 |
+
public:
|
| 995 |
+
leap_second(const leap_second&) = default;
|
| 996 |
+
leap_second& operator=(const leap_second&) = default;
|
| 997 |
+
|
| 998 |
+
// unspecified additional constructors
|
| 999 |
+
|
| 1000 |
+
constexpr sys_seconds date() const noexcept;
|
| 1001 |
+
constexpr seconds value() const noexcept;
|
| 1002 |
+
};
|
| 1003 |
+
}
|
| 1004 |
+
```
|
| 1005 |
+
|
| 1006 |
+
Objects of type `leap_second` representing the date and value of the
|
| 1007 |
+
leap second insertions are constructed and stored in the time zone
|
| 1008 |
+
database when initialized.
|
| 1009 |
+
|
| 1010 |
+
[*Example 1*:
|
| 1011 |
+
|
| 1012 |
+
``` cpp
|
| 1013 |
+
for (auto& l : get_tzdb().leap_seconds)
|
| 1014 |
+
if (l <= 2018y/March/17d)
|
| 1015 |
+
cout << l.date() << ": " << l.value() << '\n';
|
| 1016 |
+
```
|
| 1017 |
+
|
| 1018 |
+
Produces the output:
|
| 1019 |
+
|
| 1020 |
+
``` cpp
|
| 1021 |
+
1972-07-01 00:00:00: 1s
|
| 1022 |
+
1973-01-01 00:00:00: 1s
|
| 1023 |
+
1974-01-01 00:00:00: 1s
|
| 1024 |
+
1975-01-01 00:00:00: 1s
|
| 1025 |
+
1976-01-01 00:00:00: 1s
|
| 1026 |
+
1977-01-01 00:00:00: 1s
|
| 1027 |
+
1978-01-01 00:00:00: 1s
|
| 1028 |
+
1979-01-01 00:00:00: 1s
|
| 1029 |
+
1980-01-01 00:00:00: 1s
|
| 1030 |
+
1981-07-01 00:00:00: 1s
|
| 1031 |
+
1982-07-01 00:00:00: 1s
|
| 1032 |
+
1983-07-01 00:00:00: 1s
|
| 1033 |
+
1985-07-01 00:00:00: 1s
|
| 1034 |
+
1988-01-01 00:00:00: 1s
|
| 1035 |
+
1990-01-01 00:00:00: 1s
|
| 1036 |
+
1991-01-01 00:00:00: 1s
|
| 1037 |
+
1992-07-01 00:00:00: 1s
|
| 1038 |
+
1993-07-01 00:00:00: 1s
|
| 1039 |
+
1994-07-01 00:00:00: 1s
|
| 1040 |
+
1996-01-01 00:00:00: 1s
|
| 1041 |
+
1997-07-01 00:00:00: 1s
|
| 1042 |
+
1999-01-01 00:00:00: 1s
|
| 1043 |
+
2006-01-01 00:00:00: 1s
|
| 1044 |
+
2009-01-01 00:00:00: 1s
|
| 1045 |
+
2012-07-01 00:00:00: 1s
|
| 1046 |
+
2015-07-01 00:00:00: 1s
|
| 1047 |
+
2017-01-01 00:00:00: 1s
|
| 1048 |
+
```
|
| 1049 |
+
|
| 1050 |
+
— *end example*]
|
| 1051 |
+
|
| 1052 |
+
#### Member functions <a id="time.zone.leap.members">[[time.zone.leap.members]]</a>
|
| 1053 |
+
|
| 1054 |
+
``` cpp
|
| 1055 |
+
constexpr sys_seconds date() const noexcept;
|
| 1056 |
+
```
|
| 1057 |
+
|
| 1058 |
+
*Returns:* The date and time at which the leap second was inserted.
|
| 1059 |
+
|
| 1060 |
+
``` cpp
|
| 1061 |
+
constexpr seconds value() const noexcept;
|
| 1062 |
+
```
|
| 1063 |
+
|
| 1064 |
+
*Returns:* `+1s` to indicate a positive leap second or `-1s` to indicate
|
| 1065 |
+
a negative leap second.
|
| 1066 |
+
|
| 1067 |
+
[*Note 1*: All leap seconds inserted up through 2019 were positive leap
|
| 1068 |
+
seconds. — *end note*]
|
| 1069 |
+
|
| 1070 |
+
#### Non-member functions <a id="time.zone.leap.nonmembers">[[time.zone.leap.nonmembers]]</a>
|
| 1071 |
+
|
| 1072 |
+
``` cpp
|
| 1073 |
+
constexpr bool operator==(const leap_second& x, const leap_second& y) noexcept;
|
| 1074 |
+
```
|
| 1075 |
+
|
| 1076 |
+
*Returns:* `x.date() == y.date()`.
|
| 1077 |
+
|
| 1078 |
+
``` cpp
|
| 1079 |
+
constexpr strong_ordering operator<=>(const leap_second& x, const leap_second& y) noexcept;
|
| 1080 |
+
```
|
| 1081 |
+
|
| 1082 |
+
*Returns:* `x.date() <=> y.date()`.
|
| 1083 |
+
|
| 1084 |
+
``` cpp
|
| 1085 |
+
template<class Duration>
|
| 1086 |
+
constexpr bool operator==(const leap_second& x, const sys_time<Duration>& y) noexcept;
|
| 1087 |
+
```
|
| 1088 |
+
|
| 1089 |
+
*Returns:* `x.date() == y`.
|
| 1090 |
+
|
| 1091 |
+
``` cpp
|
| 1092 |
+
template<class Duration>
|
| 1093 |
+
constexpr bool operator<(const leap_second& x, const sys_time<Duration>& y) noexcept;
|
| 1094 |
+
```
|
| 1095 |
+
|
| 1096 |
+
*Returns:* `x.date() < y`.
|
| 1097 |
+
|
| 1098 |
+
``` cpp
|
| 1099 |
+
template<class Duration>
|
| 1100 |
+
constexpr bool operator<(const sys_time<Duration>& x, const leap_second& y) noexcept;
|
| 1101 |
+
```
|
| 1102 |
+
|
| 1103 |
+
*Returns:* `x < y.date()`.
|
| 1104 |
+
|
| 1105 |
+
``` cpp
|
| 1106 |
+
template<class Duration>
|
| 1107 |
+
constexpr bool operator>(const leap_second& x, const sys_time<Duration>& y) noexcept;
|
| 1108 |
+
```
|
| 1109 |
+
|
| 1110 |
+
*Returns:* `y < x`.
|
| 1111 |
+
|
| 1112 |
+
``` cpp
|
| 1113 |
+
template<class Duration>
|
| 1114 |
+
constexpr bool operator>(const sys_time<Duration>& x, const leap_second& y) noexcept;
|
| 1115 |
+
```
|
| 1116 |
+
|
| 1117 |
+
*Returns:* `y < x`.
|
| 1118 |
+
|
| 1119 |
+
``` cpp
|
| 1120 |
+
template<class Duration>
|
| 1121 |
+
constexpr bool operator<=(const leap_second& x, const sys_time<Duration>& y) noexcept;
|
| 1122 |
+
```
|
| 1123 |
+
|
| 1124 |
+
*Returns:* `!(y < x)`.
|
| 1125 |
+
|
| 1126 |
+
``` cpp
|
| 1127 |
+
template<class Duration>
|
| 1128 |
+
constexpr bool operator<=(const sys_time<Duration>& x, const leap_second& y) noexcept;
|
| 1129 |
+
```
|
| 1130 |
+
|
| 1131 |
+
*Returns:* `!(y < x)`.
|
| 1132 |
+
|
| 1133 |
+
``` cpp
|
| 1134 |
+
template<class Duration>
|
| 1135 |
+
constexpr bool operator>=(const leap_second& x, const sys_time<Duration>& y) noexcept;
|
| 1136 |
+
```
|
| 1137 |
+
|
| 1138 |
+
*Returns:* `!(x < y)`.
|
| 1139 |
+
|
| 1140 |
+
``` cpp
|
| 1141 |
+
template<class Duration>
|
| 1142 |
+
constexpr bool operator>=(const sys_time<Duration>& x, const leap_second& y) noexcept;
|
| 1143 |
+
```
|
| 1144 |
+
|
| 1145 |
+
*Returns:* `!(x < y)`.
|
| 1146 |
+
|
| 1147 |
+
``` cpp
|
| 1148 |
+
template<class Duration>
|
| 1149 |
+
requires three_way_comparable_with<sys_seconds, sys_time<Duration>>
|
| 1150 |
+
constexpr auto operator<=>(const leap_second& x, const sys_time<Duration>& y) noexcept;
|
| 1151 |
+
```
|
| 1152 |
+
|
| 1153 |
+
*Returns:* `x.date() <=> y`.
|
| 1154 |
+
|
| 1155 |
+
### Class `time_zone_link` <a id="time.zone.link">[[time.zone.link]]</a>
|
| 1156 |
+
|
| 1157 |
+
#### Overview <a id="time.zone.link.overview">[[time.zone.link.overview]]</a>
|
| 1158 |
+
|
| 1159 |
+
``` cpp
|
| 1160 |
+
namespace std::chrono {
|
| 1161 |
+
class time_zone_link {
|
| 1162 |
+
public:
|
| 1163 |
+
time_zone_link(time_zone_link&&) = default;
|
| 1164 |
+
time_zone_link& operator=(time_zone_link&&) = default;
|
| 1165 |
+
|
| 1166 |
+
// unspecified additional constructors
|
| 1167 |
+
|
| 1168 |
+
string_view name() const noexcept;
|
| 1169 |
+
string_view target() const noexcept;
|
| 1170 |
+
};
|
| 1171 |
+
}
|
| 1172 |
+
```
|
| 1173 |
+
|
| 1174 |
+
A `time_zone_link` specifies an alternative name for a `time_zone`.
|
| 1175 |
+
`time_zone_link`s are constructed when the time zone database is
|
| 1176 |
+
initialized.
|
| 1177 |
+
|
| 1178 |
+
#### Member functions <a id="time.zone.link.members">[[time.zone.link.members]]</a>
|
| 1179 |
+
|
| 1180 |
+
``` cpp
|
| 1181 |
+
string_view name() const noexcept;
|
| 1182 |
+
```
|
| 1183 |
+
|
| 1184 |
+
*Returns:* The alternative name for the time zone.
|
| 1185 |
+
|
| 1186 |
+
``` cpp
|
| 1187 |
+
string_view target() const noexcept;
|
| 1188 |
+
```
|
| 1189 |
+
|
| 1190 |
+
*Returns:* The name of the `time_zone` for which this `time_zone_link`
|
| 1191 |
+
provides an alternative name.
|
| 1192 |
+
|
| 1193 |
+
#### Non-member functions <a id="time.zone.link.nonmembers">[[time.zone.link.nonmembers]]</a>
|
| 1194 |
+
|
| 1195 |
+
``` cpp
|
| 1196 |
+
bool operator==(const time_zone_link& x, const time_zone_link& y) noexcept;
|
| 1197 |
+
```
|
| 1198 |
+
|
| 1199 |
+
*Returns:* `x.name() == y.name()`.
|
| 1200 |
+
|
| 1201 |
+
``` cpp
|
| 1202 |
+
strong_ordering operator<=>(const time_zone_link& x, const time_zone_link& y) noexcept;
|
| 1203 |
+
```
|
| 1204 |
+
|
| 1205 |
+
*Returns:* `x.name() <=> y.name()`.
|
| 1206 |
+
|