Files
2025-10-25 03:02:53 +03:00

118 lines
3.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[time.zone.members]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#members)
### 30.11.5 Class time_zone [[time.zone.timezone]](time.zone.timezone#time.zone.members)
#### 30.11.5.2 Member functions [time.zone.members]
[🔗](#lib:name,time_zone)
`string_view name() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9443)
*Returns*: The name of the time_zone[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9447)
[*Example [1](#example-1)*:
"America/New_York"[.](#2.sentence-1)
— *end example*]
[🔗](#lib:get_info,time_zone)
`template<class Duration>
sys_info get_info(const sys_time<Duration>& st) const;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9460)
*Returns*: A sys_info i for whichst is in the range [i.begin, i.end)[.](#3.sentence-1)
[🔗](#lib:get_info,time_zone_)
`template<class Duration>
local_info get_info(const local_time<Duration>& tp) const;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9473)
*Returns*: A local_info for tp[.](#4.sentence-1)
[🔗](#lib:to_sys,time_zone)
`template<class Duration>
sys_time<common_type_t<Duration, seconds>>
to_sys(const local_time<Duration>& tp) const;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9486)
*Returns*: A sys_time that is at least as fine as seconds,
and will be finer if the argument tp has finer precision[.](#5.sentence-1)
This sys_time is the UTC equivalent of tp according to the rules of this time_zone[.](#5.sentence-2)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9493)
*Throws*: If the conversion from tp to a sys_time is ambiguous,
throws ambiguous_local_time[.](#6.sentence-1)
If the tp represents a non-existent time between two UTC time_points,
throws nonexistent_local_time[.](#6.sentence-2)
[🔗](#lib:to_sys,time_zone_)
`template<class Duration>
sys_time<common_type_t<Duration, seconds>>
to_sys(const local_time<Duration>& tp, choose z) const;
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9509)
*Returns*: A sys_time that is at least as fine as seconds,
and will be finer if the argument tp has finer precision[.](#7.sentence-1)
This sys_time is the UTC equivalent of tp according to the rules of this time_zone[.](#7.sentence-2)
If the conversion from tp to a sys_time is ambiguous,
returns the earlier sys_time if z == choose::earliest, and
returns the later sys_time if z == choose::latest[.](#7.sentence-3)
If the tp represents a non-existent time between two UTC time_points,
then the two UTC time_points will be the same,
and that UTC time_point will be returned[.](#7.sentence-4)
[🔗](#lib:to_local,time_zone)
`template<class Duration>
local_time<common_type_t<Duration, seconds>>
to_local(const sys_time<Duration>& tp) const;
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9531)
*Returns*: The local_time associated with tp and this time_zone[.](#8.sentence-1)