On this page
std::chrono::time_zone::to_sys
|
(since C++20) | |
|
(since C++20) |
Converts the local_time tp in this time zone to the corresponding sys_time.
tp represents a nonexistent time.
z:
- If
z == std::chrono::choose::earliest, returns the earliersys_time. - If
z == std::chrono::choose::latest, returns the latersys_time.
tp represents a nonexistent time between two UTC time_points, those two time_points will be the same, and that time_point will be returned.
Return value
The UTC equivalent of tp according to the rules of this time zone.
Exceptions
1) Throws:std::chrono::ambiguous_local_timeif the conversion is ambiguous,std::chrono::nonexistent_local_timeiftprepresents a nonexistent time.
Notes
The precision of the result is at least std::chrono::seconds, and will be finer if the argument has finer precision.
Ambiguous and nonexistent local times can occur as a result of time zone transitions (such as daylight saving time). For example, "2016-03-13 02:30:00" does not exist in the "America/New_York" time zone, while "2016-11-06 01:30:00" in that time zone can correspond to two UTC time points: 2016-11-06 05:30:00 UTC and 2016-11-06 06:30:00 UTC.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/chrono/time_zone/to_sys