This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

386
cppdraft/time/zone/db.md Normal file
View File

@@ -0,0 +1,386 @@
[time.zone.db]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#db)
### 30.11.2 Time zone database [time.zone.db]
#### [30.11.2.1](#tzdb) Class tzdb [[time.zone.db.tzdb]](time.zone.db.tzdb)
namespace std::chrono {struct tzdb { string version;
vector<time_zone> zones;
vector<time_zone_link> links;
vector<leap_second> leap_seconds; const time_zone* locate_zone(string_view tz_name) const; const time_zone* current_zone() const; };}
[1](#tzdb-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8753)
Each vector in a tzdb object
is sorted to enable fast lookup[.](#tzdb-1.sentence-1)
[🔗](#lib:locate_zone,tzdb)
`const time_zone* locate_zone(string_view tz_name) const;
`
[2](#tzdb-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8763)
*Returns*:
- [(2.1)](#tzdb-2.1)
If zones contains an element tz for which tz.name() == tz_name,
a pointer to tz;
- [(2.2)](#tzdb-2.2)
otherwise,
if links contains an element tz_l for which tz_l.name() == tz_name,
then a pointer to the element tz of zones for which tz.name() == tz_l.target()[.](#tzdb-2.sentence-1)
[*Note [1](#tzdb-note-1)*:
A time_zone_link specifies an alternative name for a time_zone[.](#tzdb-2.sentence-2)
— *end note*]
[3](#tzdb-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8781)
*Throws*: If a const time_zone* cannot be found
as described in the *Returns*: element,
throws a runtime_error[.](#tzdb-3.sentence-1)
[*Note [2](#tzdb-note-2)*:
On non-exceptional return, the return value is always a pointer to a valid time_zone[.](#tzdb-3.sentence-2)
— *end note*]
[🔗](#lib:current_zone,tzdb)
`const time_zone* current_zone() const;
`
[4](#tzdb-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8797)
*Returns*: A pointer to the time zone which the computer has set as its local time zone[.](#tzdb-4.sentence-1)
#### [30.11.2.2](#list) Class tzdb_list [[time.zone.db.list]](time.zone.db.list)
namespace std::chrono {class tzdb_list {public: tzdb_list(const tzdb_list&) = delete;
tzdb_list& operator=(const tzdb_list&) = delete; // unspecified additional constructorsclass const_iterator; const tzdb& front() const noexcept;
const_iterator erase_after(const_iterator p);
const_iterator begin() const noexcept;
const_iterator end() const noexcept;
const_iterator cbegin() const noexcept;
const_iterator cend() const noexcept; };}
[1](#list-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8829)
The tzdb_list database is a singleton;
the unique object of type tzdb_list can be
accessed via the get_tzdb_list() function[.](#list-1.sentence-1)
[*Note [1](#list-note-1)*:
This access is only needed for those applications
that need to have long uptimes and
have a need to update the time zone database while running[.](#list-1.sentence-2)
Other applications can implicitly access the front() of this list
via the read-only namespace scope functionsget_tzdb(),locate_zone(), andcurrent_zone()[.](#list-1.sentence-3)
— *end note*]
The tzdb_list object contains a list of tzdb objects[.](#list-1.sentence-4)
[2](#list-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8845)
tzdb_list::const_iterator is a constant iterator
which meets the [*Cpp17ForwardIterator*](forward.iterators#:Cpp17ForwardIterator "24.3.5.5Forward iterators[forward.iterators]") requirements
and has a value type of tzdb[.](#list-2.sentence-1)
[🔗](#lib:front,tzdb_list)
`const tzdb& front() const noexcept;
`
[3](#list-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8856)
*Synchronization*: This operation is thread-safe with respect to reload_tzdb()[.](#list-3.sentence-1)
[*Note [2](#list-note-2)*:
reload_tzdb() pushes a new tzdb onto the front of this container[.](#list-3.sentence-2)
— *end note*]
[4](#list-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8864)
*Returns*: A reference to the first tzdb in the container[.](#list-4.sentence-1)
[🔗](#lib:erase_after,tzdb_list)
`const_iterator erase_after(const_iterator p);
`
[5](#list-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8875)
*Preconditions*: The iterator following p is dereferenceable[.](#list-5.sentence-1)
[6](#list-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8879)
*Effects*: Erases the tzdb referred to by the iterator following p[.](#list-6.sentence-1)
[7](#list-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8883)
*Postconditions*: No pointers, references, or iterators are invalidated
except those referring to the erased tzdb[.](#list-7.sentence-1)
[*Note [3](#list-note-3)*:
It is not possible to erase the tzdb referred to by begin()[.](#list-7.sentence-2)
— *end note*]
[8](#list-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8892)
*Returns*: An iterator pointing to the element following the one that was erased,
or end() if no such element exists[.](#list-8.sentence-1)
[9](#list-9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8897)
*Throws*: Nothing[.](#list-9.sentence-1)
[🔗](#lib:begin,tzdb_list)
`const_iterator begin() const noexcept;
`
[10](#list-10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8908)
*Returns*: An iterator referring to the first tzdb in the container[.](#list-10.sentence-1)
[🔗](#lib:end,tzdb_list)
`const_iterator end() const noexcept;
`
[11](#list-11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8919)
*Returns*: An iterator referring to the position one past the last tzdb in the container[.](#list-11.sentence-1)
[🔗](#lib:cbegin,tzdb_list)
`const_iterator cbegin() const noexcept;
`
[12](#list-12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8930)
*Returns*: begin()[.](#list-12.sentence-1)
[🔗](#lib:cend,tzdb_list)
`const_iterator cend() const noexcept;
`
[13](#list-13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8941)
*Returns*: end()[.](#list-13.sentence-1)
#### [30.11.2.3](#access) Time zone database access [[time.zone.db.access]](time.zone.db.access)
[🔗](#lib:get_tzdb_list)
`tzdb_list& get_tzdb_list();
`
[1](#access-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8954)
*Effects*: If this is the first access to the time zone database,
initializes the database[.](#access-1.sentence-1)
If this call initializes the database,
the resulting database will be a tzdb_list holding a single initialized tzdb[.](#access-1.sentence-2)
[2](#access-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8962)
*Synchronization*: It is safe to call this function from multiple threads at one time[.](#access-2.sentence-1)
[3](#access-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8966)
*Returns*: A reference to the database[.](#access-3.sentence-1)
[4](#access-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8970)
*Throws*: runtime_error if for any reason
a reference cannot be returned to a valid tzdb_list containing one or more valid tzdbs[.](#access-4.sentence-1)
[🔗](#lib:get_tzdb)
`const tzdb& get_tzdb();
`
[5](#access-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8983)
*Returns*: get_tzdb_list().front()[.](#access-5.sentence-1)
[🔗](#lib:locate_zone)
`const time_zone* locate_zone(string_view tz_name);
`
[6](#access-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8994)
*Returns*: get_tzdb().locate_zone(tz_name)[.](#access-6.sentence-1)
[7](#access-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8998)
[*Note [1](#access-note-1)*:
The time zone database will be initialized
if this is the first reference to the database[.](#access-7.sentence-1)
— *end note*]
[🔗](#lib:current_zone)
`const time_zone* current_zone();
`
[8](#access-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9011)
*Returns*: get_tzdb().current_zone()[.](#access-8.sentence-1)
#### [30.11.2.4](#remote) Remote time zone database support [[time.zone.db.remote]](time.zone.db.remote)
[1](#remote-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9018)
The local time zone database
is that supplied by the implementation
when the program first accesses the database,
for example via current_zone()[.](#remote-1.sentence-1)
While the program is running,
the implementation may choose to update the time zone database[.](#remote-1.sentence-2)
This update shall not impact the program in any way
unless the program calls the functions in this subclause[.](#remote-1.sentence-3)
This potentially updated time zone database
is referred to as the [*remote time zone database*](#def:remote_time_zone_database "30.11.2.4Remote time zone database support[time.zone.db.remote]")[.](#remote-1.sentence-4)
[🔗](#lib:reload_tzdb)
`const tzdb& reload_tzdb();
`
[2](#remote-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9036)
*Effects*: This function first checks
the version of the remote time zone database[.](#remote-2.sentence-1)
If the versions of the local and remote databases are the same,
there are no effects[.](#remote-2.sentence-2)
Otherwise the remote database is pushed
to the front of the tzdb_list accessed by get_tzdb_list()[.](#remote-2.sentence-3)
[3](#remote-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9046)
*Synchronization*: This function is thread-safe with respect toget_tzdb_list().front() and get_tzdb_list().erase_after()[.](#remote-3.sentence-1)
[4](#remote-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9051)
*Postconditions*: No pointers, references, or iterators are invalidated[.](#remote-4.sentence-1)
[5](#remote-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9055)
*Returns*: get_tzdb_list().front()[.](#remote-5.sentence-1)
[6](#remote-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9059)
*Throws*: runtime_error if for any reason
a reference cannot be returned to a valid tzdb[.](#remote-6.sentence-1)
[🔗](#lib:remote_version)
`string remote_version();
`
[7](#remote-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9071)
*Returns*: The latest remote database version[.](#remote-7.sentence-1)
[*Note [1](#remote-note-1)*:
This can be compared with get_tzdb().version to discover if the local and remote databases are equivalent[.](#remote-7.sentence-2)
— *end note*]

View File

@@ -0,0 +1,87 @@
[time.zone.db.access]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#db.access)
### 30.11.2 Time zone database [[time.zone.db]](time.zone.db#access)
#### 30.11.2.3 Time zone database access [time.zone.db.access]
[🔗](#lib:get_tzdb_list)
`tzdb_list& get_tzdb_list();
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8954)
*Effects*: If this is the first access to the time zone database,
initializes the database[.](#1.sentence-1)
If this call initializes the database,
the resulting database will be a tzdb_list holding a single initialized tzdb[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8962)
*Synchronization*: It is safe to call this function from multiple threads at one time[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8966)
*Returns*: A reference to the database[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8970)
*Throws*: runtime_error if for any reason
a reference cannot be returned to a valid tzdb_list containing one or more valid tzdbs[.](#4.sentence-1)
[🔗](#lib:get_tzdb)
`const tzdb& get_tzdb();
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8983)
*Returns*: get_tzdb_list().front()[.](#5.sentence-1)
[🔗](#lib:locate_zone)
`const time_zone* locate_zone(string_view tz_name);
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8994)
*Returns*: get_tzdb().locate_zone(tz_name)[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8998)
[*Note [1](#note-1)*:
The time zone database will be initialized
if this is the first reference to the database[.](#7.sentence-1)
— *end note*]
[🔗](#lib:current_zone)
`const time_zone* current_zone();
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9011)
*Returns*: get_tzdb().current_zone()[.](#8.sentence-1)

View File

@@ -0,0 +1,159 @@
[time.zone.db.list]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#db.list)
### 30.11.2 Time zone database [[time.zone.db]](time.zone.db#list)
#### 30.11.2.2 Class tzdb_list [time.zone.db.list]
namespace std::chrono {class tzdb_list {public: tzdb_list(const tzdb_list&) = delete;
tzdb_list& operator=(const tzdb_list&) = delete; // unspecified additional constructorsclass const_iterator; const tzdb& front() const noexcept;
const_iterator erase_after(const_iterator p);
const_iterator begin() const noexcept;
const_iterator end() const noexcept;
const_iterator cbegin() const noexcept;
const_iterator cend() const noexcept; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8829)
The tzdb_list database is a singleton;
the unique object of type tzdb_list can be
accessed via the get_tzdb_list() function[.](#1.sentence-1)
[*Note [1](#note-1)*:
This access is only needed for those applications
that need to have long uptimes and
have a need to update the time zone database while running[.](#1.sentence-2)
Other applications can implicitly access the front() of this list
via the read-only namespace scope functionsget_tzdb(),locate_zone(), andcurrent_zone()[.](#1.sentence-3)
— *end note*]
The tzdb_list object contains a list of tzdb objects[.](#1.sentence-4)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8845)
tzdb_list::const_iterator is a constant iterator
which meets the [*Cpp17ForwardIterator*](forward.iterators#:Cpp17ForwardIterator "24.3.5.5Forward iterators[forward.iterators]") requirements
and has a value type of tzdb[.](#2.sentence-1)
[🔗](#lib:front,tzdb_list)
`const tzdb& front() const noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8856)
*Synchronization*: This operation is thread-safe with respect to reload_tzdb()[.](#3.sentence-1)
[*Note [2](#note-2)*:
reload_tzdb() pushes a new tzdb onto the front of this container[.](#3.sentence-2)
— *end note*]
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8864)
*Returns*: A reference to the first tzdb in the container[.](#4.sentence-1)
[🔗](#lib:erase_after,tzdb_list)
`const_iterator erase_after(const_iterator p);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8875)
*Preconditions*: The iterator following p is dereferenceable[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8879)
*Effects*: Erases the tzdb referred to by the iterator following p[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8883)
*Postconditions*: No pointers, references, or iterators are invalidated
except those referring to the erased tzdb[.](#7.sentence-1)
[*Note [3](#note-3)*:
It is not possible to erase the tzdb referred to by begin()[.](#7.sentence-2)
— *end note*]
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8892)
*Returns*: An iterator pointing to the element following the one that was erased,
or end() if no such element exists[.](#8.sentence-1)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8897)
*Throws*: Nothing[.](#9.sentence-1)
[🔗](#lib:begin,tzdb_list)
`const_iterator begin() const noexcept;
`
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8908)
*Returns*: An iterator referring to the first tzdb in the container[.](#10.sentence-1)
[🔗](#lib:end,tzdb_list)
`const_iterator end() const noexcept;
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8919)
*Returns*: An iterator referring to the position one past the last tzdb in the container[.](#11.sentence-1)
[🔗](#lib:cbegin,tzdb_list)
`const_iterator cbegin() const noexcept;
`
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8930)
*Returns*: begin()[.](#12.sentence-1)
[🔗](#lib:cend,tzdb_list)
`const_iterator cend() const noexcept;
`
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8941)
*Returns*: end()[.](#13.sentence-1)

View File

@@ -0,0 +1,87 @@
[time.zone.db.remote]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#db.remote)
### 30.11.2 Time zone database [[time.zone.db]](time.zone.db#remote)
#### 30.11.2.4 Remote time zone database support [time.zone.db.remote]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9018)
The local time zone database
is that supplied by the implementation
when the program first accesses the database,
for example via current_zone()[.](#1.sentence-1)
While the program is running,
the implementation may choose to update the time zone database[.](#1.sentence-2)
This update shall not impact the program in any way
unless the program calls the functions in this subclause[.](#1.sentence-3)
This potentially updated time zone database
is referred to as the [*remote time zone database*](#def:remote_time_zone_database "30.11.2.4Remote time zone database support[time.zone.db.remote]")[.](#1.sentence-4)
[🔗](#lib:reload_tzdb)
`const tzdb& reload_tzdb();
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9036)
*Effects*: This function first checks
the version of the remote time zone database[.](#2.sentence-1)
If the versions of the local and remote databases are the same,
there are no effects[.](#2.sentence-2)
Otherwise the remote database is pushed
to the front of the tzdb_list accessed by get_tzdb_list()[.](#2.sentence-3)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9046)
*Synchronization*: This function is thread-safe with respect toget_tzdb_list().front() and get_tzdb_list().erase_after()[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9051)
*Postconditions*: No pointers, references, or iterators are invalidated[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9055)
*Returns*: get_tzdb_list().front()[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9059)
*Throws*: runtime_error if for any reason
a reference cannot be returned to a valid tzdb[.](#6.sentence-1)
[🔗](#lib:remote_version)
`string remote_version();
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9071)
*Returns*: The latest remote database version[.](#7.sentence-1)
[*Note [1](#note-1)*:
This can be compared with get_tzdb().version to discover if the local and remote databases are equivalent[.](#7.sentence-2)
— *end note*]

View File

@@ -0,0 +1,74 @@
[time.zone.db.tzdb]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#db.tzdb)
### 30.11.2 Time zone database [[time.zone.db]](time.zone.db#tzdb)
#### 30.11.2.1 Class tzdb [time.zone.db.tzdb]
namespace std::chrono {struct tzdb { string version;
vector<time_zone> zones;
vector<time_zone_link> links;
vector<leap_second> leap_seconds; const time_zone* locate_zone(string_view tz_name) const; const time_zone* current_zone() const; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8753)
Each vector in a tzdb object
is sorted to enable fast lookup[.](#1.sentence-1)
[🔗](#lib:locate_zone,tzdb)
`const time_zone* locate_zone(string_view tz_name) const;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8763)
*Returns*:
- [(2.1)](#2.1)
If zones contains an element tz for which tz.name() == tz_name,
a pointer to tz;
- [(2.2)](#2.2)
otherwise,
if links contains an element tz_l for which tz_l.name() == tz_name,
then a pointer to the element tz of zones for which tz.name() == tz_l.target()[.](#2.sentence-1)
[*Note [1](#note-1)*:
A time_zone_link specifies an alternative name for a time_zone[.](#2.sentence-2)
— *end note*]
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8781)
*Throws*: If a const time_zone* cannot be found
as described in the *Returns*: element,
throws a runtime_error[.](#3.sentence-1)
[*Note [2](#note-2)*:
On non-exceptional return, the return value is always a pointer to a valid time_zone[.](#3.sentence-2)
— *end note*]
[🔗](#lib:current_zone,tzdb)
`const time_zone* current_zone() const;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8797)
*Returns*: A pointer to the time zone which the computer has set as its local time zone[.](#4.sentence-1)

View File

@@ -0,0 +1,106 @@
[time.zone.exception]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#exception)
### 30.11.3 Exception classes [time.zone.exception]
#### [30.11.3.1](#nonexist) Class nonexistent_local_time [[time.zone.exception.nonexist]](time.zone.exception.nonexist)
namespace std::chrono {class nonexistent_local_time : public runtime_error {public:template<class Duration> nonexistent_local_time(const local_time<Duration>& tp, const local_info& i); };}
[1](#nonexist-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9096)
nonexistent_local_time is thrown when
an attempt is made
to convert a non-existent local_time to a sys_time without specifying choose::earliest or choose::latest[.](#nonexist-1.sentence-1)
[🔗](#lib:nonexistent_local_time,constructor)
`template<class Duration>
nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
`
[2](#nonexist-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9109)
*Preconditions*: i.result == local_info::nonexistent is true[.](#nonexist-2.sentence-1)
[3](#nonexist-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9113)
*Effects*: Initializes the base class with a sequence of char equivalent to that produced by os.str() initialized as shown below:ostringstream os;
os << tp << " is in a gap between\n"<< local_seconds{i.first.end.time_since_epoch()} + i.first.offset << ' '<< i.first.abbrev << " and\n"<< local_seconds{i.second.begin.time_since_epoch()} + i.second.offset << ' '<< i.second.abbrev << " which are both equivalent to\n"<< i.first.end << " UTC";
[4](#nonexist-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9129)
[*Example [1](#nonexist-example-1)*: #include <chrono>#include <iostream>int main() {using namespace std::chrono; try {auto zt = zoned_time{"America/New_York",
local_days{Sunday[2]/March/2016} + 2h + 30min}; } catch (const nonexistent_local_time& e) { std::cout << e.what() << '\n'; }}
Produces the output:
```
2016-03-13 02:30:00 is in a gap between
2016-03-13 02:00:00 EST and
2016-03-13 03:00:00 EDT which are both equivalent to
2016-03-13 07:00:00 UTC
```
— *end example*]
#### [30.11.3.2](#ambig) Class ambiguous_local_time [[time.zone.exception.ambig]](time.zone.exception.ambig)
namespace std::chrono {class ambiguous_local_time : public runtime_error {public:template<class Duration> ambiguous_local_time(const local_time<Duration>& tp, const local_info& i); };}
[1](#ambig-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9169)
ambiguous_local_time is thrown when
an attempt is made
to convert an ambiguous local_time to a sys_time without specifying choose::earliest or choose::latest[.](#ambig-1.sentence-1)
[🔗](#lib:ambiguous_local_time,constructor)
`template<class Duration>
ambiguous_local_time(const local_time<Duration>& tp, const local_info& i);
`
[2](#ambig-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9182)
*Preconditions*: i.result == local_info::ambiguous is true[.](#ambig-2.sentence-1)
[3](#ambig-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9186)
*Effects*: Initializes the base class with a sequence of char equivalent to that produced by os.str() initialized as shown below:ostringstream os;
os << tp << " is ambiguous. It could be\n"<< tp << ' ' << i.first.abbrev << " == "<< tp - i.first.offset << " UTC or\n"<< tp << ' ' << i.second.abbrev << " == "<< tp - i.second.offset << " UTC";
[4](#ambig-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9200)
[*Example [1](#ambig-example-1)*: #include <chrono>#include <iostream>int main() {using namespace std::chrono; try {auto zt = zoned_time{"America/New_York",
local_days{Sunday[1]/November/2016} + 1h + 30min}; } catch (const ambiguous_local_time& e) { std::cout << e.what() << '\n'; }}
Produces the output:
```
2016-11-06 01:30:00 is ambiguous. It could be
2016-11-06 01:30:00 EDT == 2016-11-06 05:30:00 UTC or
2016-11-06 01:30:00 EST == 2016-11-06 06:30:00 UTC
```
— *end example*]

View File

@@ -0,0 +1,56 @@
[time.zone.exception.ambig]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#exception.ambig)
### 30.11.3 Exception classes [[time.zone.exception]](time.zone.exception#ambig)
#### 30.11.3.2 Class ambiguous_local_time [time.zone.exception.ambig]
namespace std::chrono {class ambiguous_local_time : public runtime_error {public:template<class Duration> ambiguous_local_time(const local_time<Duration>& tp, const local_info& i); };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9169)
ambiguous_local_time is thrown when
an attempt is made
to convert an ambiguous local_time to a sys_time without specifying choose::earliest or choose::latest[.](#1.sentence-1)
[🔗](#lib:ambiguous_local_time,constructor)
`template<class Duration>
ambiguous_local_time(const local_time<Duration>& tp, const local_info& i);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9182)
*Preconditions*: i.result == local_info::ambiguous is true[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9186)
*Effects*: Initializes the base class with a sequence of char equivalent to that produced by os.str() initialized as shown below:ostringstream os;
os << tp << " is ambiguous. It could be\n"<< tp << ' ' << i.first.abbrev << " == "<< tp - i.first.offset << " UTC or\n"<< tp << ' ' << i.second.abbrev << " == "<< tp - i.second.offset << " UTC";
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9200)
[*Example [1](#example-1)*: #include <chrono>#include <iostream>int main() {using namespace std::chrono; try {auto zt = zoned_time{"America/New_York",
local_days{Sunday[1]/November/2016} + 1h + 30min}; } catch (const ambiguous_local_time& e) { std::cout << e.what() << '\n'; }}
Produces the output:
```
2016-11-06 01:30:00 is ambiguous. It could be
2016-11-06 01:30:00 EDT == 2016-11-06 05:30:00 UTC or
2016-11-06 01:30:00 EST == 2016-11-06 06:30:00 UTC
```
— *end example*]

View File

@@ -0,0 +1,57 @@
[time.zone.exception.nonexist]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#exception.nonexist)
### 30.11.3 Exception classes [[time.zone.exception]](time.zone.exception#nonexist)
#### 30.11.3.1 Class nonexistent_local_time [time.zone.exception.nonexist]
namespace std::chrono {class nonexistent_local_time : public runtime_error {public:template<class Duration> nonexistent_local_time(const local_time<Duration>& tp, const local_info& i); };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9096)
nonexistent_local_time is thrown when
an attempt is made
to convert a non-existent local_time to a sys_time without specifying choose::earliest or choose::latest[.](#1.sentence-1)
[🔗](#lib:nonexistent_local_time,constructor)
`template<class Duration>
nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9109)
*Preconditions*: i.result == local_info::nonexistent is true[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9113)
*Effects*: Initializes the base class with a sequence of char equivalent to that produced by os.str() initialized as shown below:ostringstream os;
os << tp << " is in a gap between\n"<< local_seconds{i.first.end.time_since_epoch()} + i.first.offset << ' '<< i.first.abbrev << " and\n"<< local_seconds{i.second.begin.time_since_epoch()} + i.second.offset << ' '<< i.second.abbrev << " which are both equivalent to\n"<< i.first.end << " UTC";
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9129)
[*Example [1](#example-1)*: #include <chrono>#include <iostream>int main() {using namespace std::chrono; try {auto zt = zoned_time{"America/New_York",
local_days{Sunday[2]/March/2016} + 2h + 30min}; } catch (const nonexistent_local_time& e) { std::cout << e.what() << '\n'; }}
Produces the output:
```
2016-03-13 02:30:00 is in a gap between
2016-03-13 02:00:00 EST and
2016-03-13 03:00:00 EDT which are both equivalent to
2016-03-13 07:00:00 UTC
```
— *end example*]

View File

@@ -0,0 +1,18 @@
[time.zone.general]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#general)
### 30.11.1 General [time.zone.general]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8726)
[[time.zone]](time.zone "30.11Time zones") describes an interface for accessing
the IANA Time Zone Database[[bib]](bibliography#bib:iana-tz "Bibliography") that interoperates with sys_time and local_time[.](#1.sentence-1)
This interface provides time zone support to
both the civil calendar types ([[time.cal]](time.cal "30.8The civil calendar"))
and to user-defined calendars[.](#1.sentence-2)

167
cppdraft/time/zone/info.md Normal file
View File

@@ -0,0 +1,167 @@
[time.zone.info]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#info)
### 30.11.4 Information classes [time.zone.info]
#### [30.11.4.1](#sys) Class sys_info [[time.zone.info.sys]](time.zone.info.sys)
namespace std::chrono {struct sys_info { sys_seconds begin;
sys_seconds end;
seconds offset;
minutes save;
string abbrev; };}
[1](#sys-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9243)
A sys_info object can be obtained
from the combination of a time_zone and
either a sys_time or local_time[.](#sys-1.sentence-1)
It can also be obtained from a zoned_time,
which is effectively a pair of a time_zone and sys_time[.](#sys-1.sentence-2)
[2](#sys-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9250)
[*Note [1](#sys-note-1)*:
This type provides a low-level interface to time zone information[.](#sys-2.sentence-1)
Typical conversions from sys_time to local_time will use this class implicitly, not explicitly[.](#sys-2.sentence-2)
— *end note*]
[3](#sys-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9257)
The begin and end data members indicate that,
for the associated time_zone and time_point,
the offset and abbrev are in effect in the range [begin, end)[.](#sys-3.sentence-1)
This information can be used to efficiently iterate the transitions of a time_zone[.](#sys-3.sentence-2)
[4](#sys-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9265)
The offset data member indicates
the UTC offset in effect
for the associated time_zone and time_point[.](#sys-4.sentence-1)
The relationship between local_time and sys_time is:offset = local_time - sys_time
[5](#sys-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9275)
The save data member is extra information not normally needed
for conversion between local_time and sys_time[.](#sys-5.sentence-1)
If save != 0min, this sys_info is said to be on “daylight saving” time,
and offset - save suggests what offset this time_zone might use
if it were off daylight saving time[.](#sys-5.sentence-2)
However, this information should not be taken as authoritative[.](#sys-5.sentence-3)
The only sure way to get such information
is to query the time_zone with a time_point that returns a sys_info where save == 0min[.](#sys-5.sentence-4)
There is no guarantee what time_point might return such a sys_info except that it is guaranteed not to be in the range [begin, end)
(if save != 0min for this sys_info)[.](#sys-5.sentence-5)
[6](#sys-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9290)
The abbrev data member indicates
the current abbreviation used for the associated time_zone and time_point[.](#sys-6.sentence-1)
Abbreviations are not unique among the time_zones,
and so one cannot reliably map abbreviations back to a time_zone and UTC offset[.](#sys-6.sentence-2)
[🔗](#lib:operator%3c%3c,sys_info)
`template<class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const sys_info& r);
`
[7](#sys-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9305)
*Effects*: Streams out the sys_info object r in an unspecified format[.](#sys-7.sentence-1)
[8](#sys-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9309)
*Returns*: os[.](#sys-8.sentence-1)
#### [30.11.4.2](#local) Class local_info [[time.zone.info.local]](time.zone.info.local)
[🔗](#lib:unique,local_info)
namespace std::chrono {struct local_info {static constexpr int unique = 0; static constexpr int nonexistent = 1; static constexpr int ambiguous = 2; int result;
sys_info first;
sys_info second; };}
[1](#local-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9337)
[*Note [1](#local-note-1)*:
This type provides a low-level interface to time zone information[.](#local-1.sentence-1)
Typical conversions from local_time to sys_time will use this class implicitly, not explicitly[.](#local-1.sentence-2)
— *end note*]
[2](#local-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9344)
Describes the result of converting a local_time to a sys_time as follows:
- [(2.1)](#local-2.1)
When a local_time to sys_time conversion is unique,result == unique,first will be filled out with the correct sys_info,
andsecond will be zero-initialized[.](#local-2.1.sentence-1)
- [(2.2)](#local-2.2)
If the conversion stems from a nonexistent local_time then result == nonexistent,first will be filled out with the sys_info that ends just prior to the local_time,
andsecond will be filled out with the sys_info that begins just after the local_time[.](#local-2.2.sentence-1)
- [(2.3)](#local-2.3)
If the conversion stems from an ambiguous local_time,
then result == ambiguous,first will be filled out with the sys_info that ends just after the local_time,
andsecond will be filled out with the sys_info that starts just before the local_time[.](#local-2.3.sentence-1)
[🔗](#lib:operator%3c%3c,local_info)
`template<class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const local_info& r);
`
[3](#local-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9382)
*Effects*: Streams out the local_info object r in an unspecified format[.](#local-3.sentence-1)
[4](#local-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9386)
*Returns*: os[.](#local-4.sentence-1)

View File

@@ -0,0 +1,68 @@
[time.zone.info.local]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#info.local)
### 30.11.4 Information classes [[time.zone.info]](time.zone.info#local)
#### 30.11.4.2 Class local_info [time.zone.info.local]
[🔗](#lib:unique,local_info)
namespace std::chrono {struct local_info {static constexpr int unique = 0; static constexpr int nonexistent = 1; static constexpr int ambiguous = 2; int result;
sys_info first;
sys_info second; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9337)
[*Note [1](#note-1)*:
This type provides a low-level interface to time zone information[.](#1.sentence-1)
Typical conversions from local_time to sys_time will use this class implicitly, not explicitly[.](#1.sentence-2)
— *end note*]
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9344)
Describes the result of converting a local_time to a sys_time as follows:
- [(2.1)](#2.1)
When a local_time to sys_time conversion is unique,result == unique,first will be filled out with the correct sys_info,
andsecond will be zero-initialized[.](#2.1.sentence-1)
- [(2.2)](#2.2)
If the conversion stems from a nonexistent local_time then result == nonexistent,first will be filled out with the sys_info that ends just prior to the local_time,
andsecond will be filled out with the sys_info that begins just after the local_time[.](#2.2.sentence-1)
- [(2.3)](#2.3)
If the conversion stems from an ambiguous local_time,
then result == ambiguous,first will be filled out with the sys_info that ends just after the local_time,
andsecond will be filled out with the sys_info that starts just before the local_time[.](#2.3.sentence-1)
[🔗](#lib:operator%3c%3c,local_info)
`template<class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const local_info& r);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9382)
*Effects*: Streams out the local_info object r in an unspecified format[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9386)
*Returns*: os[.](#4.sentence-1)

View File

@@ -0,0 +1,106 @@
[time.zone.info.sys]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#info.sys)
### 30.11.4 Information classes [[time.zone.info]](time.zone.info#sys)
#### 30.11.4.1 Class sys_info [time.zone.info.sys]
namespace std::chrono {struct sys_info { sys_seconds begin;
sys_seconds end;
seconds offset;
minutes save;
string abbrev; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9243)
A sys_info object can be obtained
from the combination of a time_zone and
either a sys_time or local_time[.](#1.sentence-1)
It can also be obtained from a zoned_time,
which is effectively a pair of a time_zone and sys_time[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9250)
[*Note [1](#note-1)*:
This type provides a low-level interface to time zone information[.](#2.sentence-1)
Typical conversions from sys_time to local_time will use this class implicitly, not explicitly[.](#2.sentence-2)
— *end note*]
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9257)
The begin and end data members indicate that,
for the associated time_zone and time_point,
the offset and abbrev are in effect in the range [begin, end)[.](#3.sentence-1)
This information can be used to efficiently iterate the transitions of a time_zone[.](#3.sentence-2)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9265)
The offset data member indicates
the UTC offset in effect
for the associated time_zone and time_point[.](#4.sentence-1)
The relationship between local_time and sys_time is:offset = local_time - sys_time
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9275)
The save data member is extra information not normally needed
for conversion between local_time and sys_time[.](#5.sentence-1)
If save != 0min, this sys_info is said to be on “daylight saving” time,
and offset - save suggests what offset this time_zone might use
if it were off daylight saving time[.](#5.sentence-2)
However, this information should not be taken as authoritative[.](#5.sentence-3)
The only sure way to get such information
is to query the time_zone with a time_point that returns a sys_info where save == 0min[.](#5.sentence-4)
There is no guarantee what time_point might return such a sys_info except that it is guaranteed not to be in the range [begin, end)
(if save != 0min for this sys_info)[.](#5.sentence-5)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9290)
The abbrev data member indicates
the current abbreviation used for the associated time_zone and time_point[.](#6.sentence-1)
Abbreviations are not unique among the time_zones,
and so one cannot reliably map abbreviations back to a time_zone and UTC offset[.](#6.sentence-2)
[🔗](#lib:operator%3c%3c,sys_info)
`template<class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const sys_info& r);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9305)
*Effects*: Streams out the sys_info object r in an unspecified format[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9309)
*Returns*: os[.](#8.sentence-1)

236
cppdraft/time/zone/leap.md Normal file
View File

@@ -0,0 +1,236 @@
[time.zone.leap]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#leap)
### 30.11.8 Class leap_second [time.zone.leap]
#### [30.11.8.1](#overview) Overview [[time.zone.leap.overview]](time.zone.leap.overview)
namespace std::chrono {class leap_second {public: leap_second(const leap_second&) = default;
leap_second& operator=(const leap_second&) = default; // unspecified additional constructorsconstexpr sys_seconds date() const noexcept; constexpr seconds value() const noexcept; };}
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10136)
Objects of type leap_second representing
the date and value of the leap second insertions
are constructed and stored in the time zone database when initialized[.](#overview-1.sentence-1)
[2](#overview-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10141)
[*Example [1](#overview-example-1)*: for (auto& l : get_tzdb().leap_seconds)if (l <= sys_days{2018y/March/17d}) cout << l.date() << ": " << l.value() << '\n';
Produces the output:
```
1972-07-01 00:00:00: 1s
1973-01-01 00:00:00: 1s
1974-01-01 00:00:00: 1s
1975-01-01 00:00:00: 1s
1976-01-01 00:00:00: 1s
1977-01-01 00:00:00: 1s
1978-01-01 00:00:00: 1s
1979-01-01 00:00:00: 1s
1980-01-01 00:00:00: 1s
1981-07-01 00:00:00: 1s
1982-07-01 00:00:00: 1s
1983-07-01 00:00:00: 1s
1985-07-01 00:00:00: 1s
1988-01-01 00:00:00: 1s
1990-01-01 00:00:00: 1s
1991-01-01 00:00:00: 1s
1992-07-01 00:00:00: 1s
1993-07-01 00:00:00: 1s
1994-07-01 00:00:00: 1s
1996-01-01 00:00:00: 1s
1997-07-01 00:00:00: 1s
1999-01-01 00:00:00: 1s
2006-01-01 00:00:00: 1s
2009-01-01 00:00:00: 1s
2012-07-01 00:00:00: 1s
2015-07-01 00:00:00: 1s
2017-01-01 00:00:00: 1s
```
— *end example*]
#### [30.11.8.2](#members) Member functions [[time.zone.leap.members]](time.zone.leap.members)
[🔗](#lib:date,leap_second)
`constexpr sys_seconds date() const noexcept;
`
[1](#members-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10189)
*Returns*: The date and time at which the leap second was inserted[.](#members-1.sentence-1)
[🔗](#lib:value,leap_second)
`constexpr seconds value() const noexcept;
`
[2](#members-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10200)
*Returns*: +1s to indicate a positive leap second or-1s to indicate a negative leap second[.](#members-2.sentence-1)
[*Note [1](#members-note-1)*:
All leap seconds inserted up through 2022 were positive leap seconds[.](#members-2.sentence-2)
— *end note*]
#### [30.11.8.3](#nonmembers) Non-member functions [[time.zone.leap.nonmembers]](time.zone.leap.nonmembers)
[🔗](#lib:operator==,leap_second)
`constexpr bool operator==(const leap_second& x, const leap_second& y) noexcept;
`
[1](#nonmembers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10217)
*Returns*: x.date() == y.date()[.](#nonmembers-1.sentence-1)
[🔗](#lib:operator%3c=%3e,leap_second)
`constexpr strong_ordering operator<=>(const leap_second& x, const leap_second& y) noexcept;
`
[2](#nonmembers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10228)
*Returns*: x.date() <=> y.date()[.](#nonmembers-2.sentence-1)
[🔗](#lib:operator==,leap_second_)
`template<class Duration>
constexpr bool operator==(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[3](#nonmembers-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10241)
*Returns*: x.date() == y[.](#nonmembers-3.sentence-1)
[🔗](#lib:operator%3c,leap_second)
`template<class Duration>
constexpr bool operator<(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[4](#nonmembers-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10254)
*Returns*: x.date() < y[.](#nonmembers-4.sentence-1)
[🔗](#lib:operator%3c,leap_second_)
`template<class Duration>
constexpr bool operator<(const sys_time<Duration>& x, const leap_second& y) noexcept;
`
[5](#nonmembers-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10267)
*Returns*: x < y.date()[.](#nonmembers-5.sentence-1)
[🔗](#lib:operator%3e,leap_second)
`template<class Duration>
constexpr bool operator>(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[6](#nonmembers-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10280)
*Returns*: y < x[.](#nonmembers-6.sentence-1)
[🔗](#lib:operator%3e,leap_second_)
`template<class Duration>
constexpr bool operator>(const sys_time<Duration>& x, const leap_second& y) noexcept;
`
[7](#nonmembers-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10293)
*Returns*: y < x[.](#nonmembers-7.sentence-1)
[🔗](#lib:operator%3c=,leap_second)
`template<class Duration>
constexpr bool operator<=(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[8](#nonmembers-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10306)
*Returns*: !(y < x)[.](#nonmembers-8.sentence-1)
[🔗](#lib:operator%3c=,leap_second_)
`template<class Duration>
constexpr bool operator<=(const sys_time<Duration>& x, const leap_second& y) noexcept;
`
[9](#nonmembers-9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10319)
*Returns*: !(y < x)[.](#nonmembers-9.sentence-1)
[🔗](#lib:operator%3e=,leap_second)
`template<class Duration>
constexpr bool operator>=(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[10](#nonmembers-10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10332)
*Returns*: !(x < y)[.](#nonmembers-10.sentence-1)
[🔗](#lib:operator%3e=,leap_second_)
`template<class Duration>
constexpr bool operator>=(const sys_time<Duration>& x, const leap_second& y) noexcept;
`
[11](#nonmembers-11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10345)
*Returns*: !(x < y)[.](#nonmembers-11.sentence-1)
[🔗](#lib:operator%3c=%3e,leap_second_)
`template<class Duration>
requires [three_way_comparable_with](cmp.concept#concept:three_way_comparable_with "17.12.4Concept three_­way_­comparable[cmp.concept]")<sys_seconds, sys_time<Duration>>
constexpr auto operator<=>(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[12](#nonmembers-12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10359)
*Returns*: x.date() <=> y[.](#nonmembers-12.sentence-1)

View File

@@ -0,0 +1,37 @@
[time.zone.leap.members]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#leap.members)
### 30.11.8 Class leap_second [[time.zone.leap]](time.zone.leap#members)
#### 30.11.8.2 Member functions [time.zone.leap.members]
[🔗](#lib:date,leap_second)
`constexpr sys_seconds date() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10189)
*Returns*: The date and time at which the leap second was inserted[.](#1.sentence-1)
[🔗](#lib:value,leap_second)
`constexpr seconds value() const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10200)
*Returns*: +1s to indicate a positive leap second or-1s to indicate a negative leap second[.](#2.sentence-1)
[*Note [1](#note-1)*:
All leap seconds inserted up through 2022 were positive leap seconds[.](#2.sentence-2)
— *end note*]

View File

@@ -0,0 +1,152 @@
[time.zone.leap.nonmembers]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#leap.nonmembers)
### 30.11.8 Class leap_second [[time.zone.leap]](time.zone.leap#nonmembers)
#### 30.11.8.3 Non-member functions [time.zone.leap.nonmembers]
[🔗](#lib:operator==,leap_second)
`constexpr bool operator==(const leap_second& x, const leap_second& y) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10217)
*Returns*: x.date() == y.date()[.](#1.sentence-1)
[🔗](#lib:operator%3c=%3e,leap_second)
`constexpr strong_ordering operator<=>(const leap_second& x, const leap_second& y) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10228)
*Returns*: x.date() <=> y.date()[.](#2.sentence-1)
[🔗](#lib:operator==,leap_second_)
`template<class Duration>
constexpr bool operator==(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10241)
*Returns*: x.date() == y[.](#3.sentence-1)
[🔗](#lib:operator%3c,leap_second)
`template<class Duration>
constexpr bool operator<(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10254)
*Returns*: x.date() < y[.](#4.sentence-1)
[🔗](#lib:operator%3c,leap_second_)
`template<class Duration>
constexpr bool operator<(const sys_time<Duration>& x, const leap_second& y) noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10267)
*Returns*: x < y.date()[.](#5.sentence-1)
[🔗](#lib:operator%3e,leap_second)
`template<class Duration>
constexpr bool operator>(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10280)
*Returns*: y < x[.](#6.sentence-1)
[🔗](#lib:operator%3e,leap_second_)
`template<class Duration>
constexpr bool operator>(const sys_time<Duration>& x, const leap_second& y) noexcept;
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10293)
*Returns*: y < x[.](#7.sentence-1)
[🔗](#lib:operator%3c=,leap_second)
`template<class Duration>
constexpr bool operator<=(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10306)
*Returns*: !(y < x)[.](#8.sentence-1)
[🔗](#lib:operator%3c=,leap_second_)
`template<class Duration>
constexpr bool operator<=(const sys_time<Duration>& x, const leap_second& y) noexcept;
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10319)
*Returns*: !(y < x)[.](#9.sentence-1)
[🔗](#lib:operator%3e=,leap_second)
`template<class Duration>
constexpr bool operator>=(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10332)
*Returns*: !(x < y)[.](#10.sentence-1)
[🔗](#lib:operator%3e=,leap_second_)
`template<class Duration>
constexpr bool operator>=(const sys_time<Duration>& x, const leap_second& y) noexcept;
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10345)
*Returns*: !(x < y)[.](#11.sentence-1)
[🔗](#lib:operator%3c=%3e,leap_second_)
`template<class Duration>
requires [three_way_comparable_with](cmp.concept#concept:three_way_comparable_with "17.12.4Concept three_­way_­comparable[cmp.concept]")<sys_seconds, sys_time<Duration>>
constexpr auto operator<=>(const leap_second& x, const sys_time<Duration>& y) noexcept;
`
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10359)
*Returns*: x.date() <=> y[.](#12.sentence-1)

View File

@@ -0,0 +1,61 @@
[time.zone.leap.overview]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#leap.overview)
### 30.11.8 Class leap_second [[time.zone.leap]](time.zone.leap#overview)
#### 30.11.8.1 Overview [time.zone.leap.overview]
namespace std::chrono {class leap_second {public: leap_second(const leap_second&) = default;
leap_second& operator=(const leap_second&) = default; // unspecified additional constructorsconstexpr sys_seconds date() const noexcept; constexpr seconds value() const noexcept; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10136)
Objects of type leap_second representing
the date and value of the leap second insertions
are constructed and stored in the time zone database when initialized[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10141)
[*Example [1](#example-1)*: for (auto& l : get_tzdb().leap_seconds)if (l <= sys_days{2018y/March/17d}) cout << l.date() << ": " << l.value() << '\n';
Produces the output:
```
1972-07-01 00:00:00: 1s
1973-01-01 00:00:00: 1s
1974-01-01 00:00:00: 1s
1975-01-01 00:00:00: 1s
1976-01-01 00:00:00: 1s
1977-01-01 00:00:00: 1s
1978-01-01 00:00:00: 1s
1979-01-01 00:00:00: 1s
1980-01-01 00:00:00: 1s
1981-07-01 00:00:00: 1s
1982-07-01 00:00:00: 1s
1983-07-01 00:00:00: 1s
1985-07-01 00:00:00: 1s
1988-01-01 00:00:00: 1s
1990-01-01 00:00:00: 1s
1991-01-01 00:00:00: 1s
1992-07-01 00:00:00: 1s
1993-07-01 00:00:00: 1s
1994-07-01 00:00:00: 1s
1996-01-01 00:00:00: 1s
1997-07-01 00:00:00: 1s
1999-01-01 00:00:00: 1s
2006-01-01 00:00:00: 1s
2009-01-01 00:00:00: 1s
2012-07-01 00:00:00: 1s
2015-07-01 00:00:00: 1s
2017-01-01 00:00:00: 1s
```
— *end example*]

View File

@@ -0,0 +1,70 @@
[time.zone.link]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#link)
### 30.11.9 Class time_zone_link [time.zone.link]
#### [30.11.9.1](#overview) Overview [[time.zone.link.overview]](time.zone.link.overview)
namespace std::chrono {class time_zone_link {public: time_zone_link(time_zone_link&&) = default;
time_zone_link& operator=(time_zone_link&&) = default; // unspecified additional constructors string_view name() const noexcept;
string_view target() const noexcept; };}
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10384)
A time_zone_link specifies an alternative name for a time_zone[.](#overview-1.sentence-1)
time_zone_links are constructed when the time zone database is initialized[.](#overview-1.sentence-2)
#### [30.11.9.2](#members) Member functions [[time.zone.link.members]](time.zone.link.members)
[🔗](#lib:name,time_zone_link)
`string_view name() const noexcept;
`
[1](#members-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10396)
*Returns*: The alternative name for the time zone[.](#members-1.sentence-1)
[🔗](#lib:target,time_zone_link)
`string_view target() const noexcept;
`
[2](#members-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10407)
*Returns*: The name of the time_zone for which
this time_zone_link provides an alternative name[.](#members-2.sentence-1)
#### [30.11.9.3](#nonmembers) Non-member functions [[time.zone.link.nonmembers]](time.zone.link.nonmembers)
[🔗](#lib:operator==,time_zone_link)
`bool operator==(const time_zone_link& x, const time_zone_link& y) noexcept;
`
[1](#nonmembers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10421)
*Returns*: x.name() == y.name()[.](#nonmembers-1.sentence-1)
[🔗](#lib:operator%3c=%3e,time_zone_link)
`strong_ordering operator<=>(const time_zone_link& x, const time_zone_link& y) noexcept;
`
[2](#nonmembers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10432)
*Returns*: x.name() <=> y.name()[.](#nonmembers-2.sentence-1)

View File

@@ -0,0 +1,32 @@
[time.zone.link.members]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#link.members)
### 30.11.9 Class time_zone_link [[time.zone.link]](time.zone.link#members)
#### 30.11.9.2 Member functions [time.zone.link.members]
[🔗](#lib:name,time_zone_link)
`string_view name() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10396)
*Returns*: The alternative name for the time zone[.](#1.sentence-1)
[🔗](#lib:target,time_zone_link)
`string_view target() const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10407)
*Returns*: The name of the time_zone for which
this time_zone_link provides an alternative name[.](#2.sentence-1)

View File

@@ -0,0 +1,31 @@
[time.zone.link.nonmembers]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#link.nonmembers)
### 30.11.9 Class time_zone_link [[time.zone.link]](time.zone.link#nonmembers)
#### 30.11.9.3 Non-member functions [time.zone.link.nonmembers]
[🔗](#lib:operator==,time_zone_link)
`bool operator==(const time_zone_link& x, const time_zone_link& y) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10421)
*Returns*: x.name() == y.name()[.](#1.sentence-1)
[🔗](#lib:operator%3c=%3e,time_zone_link)
`strong_ordering operator<=>(const time_zone_link& x, const time_zone_link& y) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10432)
*Returns*: x.name() <=> y.name()[.](#2.sentence-1)

View File

@@ -0,0 +1,21 @@
[time.zone.link.overview]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#link.overview)
### 30.11.9 Class time_zone_link [[time.zone.link]](time.zone.link#overview)
#### 30.11.9.1 Overview [time.zone.link.overview]
namespace std::chrono {class time_zone_link {public: time_zone_link(time_zone_link&&) = default;
time_zone_link& operator=(time_zone_link&&) = default; // unspecified additional constructors string_view name() const noexcept;
string_view target() const noexcept; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10384)
A time_zone_link specifies an alternative name for a time_zone[.](#1.sentence-1)
time_zone_links are constructed when the time zone database is initialized[.](#1.sentence-2)

View File

@@ -0,0 +1,117 @@
[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)

View File

@@ -0,0 +1,31 @@
[time.zone.nonmembers]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#nonmembers)
### 30.11.5 Class time_zone [[time.zone.timezone]](time.zone.timezone#time.zone.nonmembers)
#### 30.11.5.3 Non-member functions [time.zone.nonmembers]
[🔗](#lib:operator==,time_zone)
`bool operator==(const time_zone& x, const time_zone& y) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9544)
*Returns*: x.name() == y.name()[.](#1.sentence-1)
[🔗](#lib:operator%3c=%3e,time_zone)
`strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9555)
*Returns*: x.name() <=> y.name()[.](#2.sentence-1)

View File

@@ -0,0 +1,29 @@
[time.zone.overview]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#overview)
### 30.11.5 Class time_zone [[time.zone.timezone]](time.zone.timezone#time.zone.overview)
#### 30.11.5.1 Overview [time.zone.overview]
namespace std::chrono {class time_zone {public: time_zone(time_zone&&) = default;
time_zone& operator=(time_zone&&) = default; // unspecified additional constructors string_view name() const noexcept; template<class Duration> sys_info get_info(const sys_time<Duration>& st) const; template<class Duration> local_info get_info(const local_time<Duration>& tp) const; template<class Duration> sys_time<common_type_t<Duration, seconds>> to_sys(const local_time<Duration>& tp) const; template<class Duration> sys_time<common_type_t<Duration, seconds>> to_sys(const local_time<Duration>& tp, choose z) const; template<class Duration> local_time<common_type_t<Duration, seconds>> to_local(const sys_time<Duration>& tp) const; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9425)
A time_zone represents all time zone transitions
for a specific geographic area[.](#1.sentence-1)
time_zone construction is unspecified,
and performed as part of database initialization[.](#1.sentence-2)
[*Note [1](#note-1)*:
const time_zone objects can be accessed
via functions such as locate_zone[.](#1.sentence-3)
— *end note*]

View File

@@ -0,0 +1,163 @@
[time.zone.timezone]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#timezone)
### 30.11.5 Class time_zone [time.zone.timezone]
#### [30.11.5.1](#time.zone.overview) Overview [[time.zone.overview]](time.zone.overview)
namespace std::chrono {class time_zone {public: time_zone(time_zone&&) = default;
time_zone& operator=(time_zone&&) = default; // unspecified additional constructors string_view name() const noexcept; template<class Duration> sys_info get_info(const sys_time<Duration>& st) const; template<class Duration> local_info get_info(const local_time<Duration>& tp) const; template<class Duration> sys_time<common_type_t<Duration, seconds>> to_sys(const local_time<Duration>& tp) const; template<class Duration> sys_time<common_type_t<Duration, seconds>> to_sys(const local_time<Duration>& tp, choose z) const; template<class Duration> local_time<common_type_t<Duration, seconds>> to_local(const sys_time<Duration>& tp) const; };}
[1](#time.zone.overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9425)
A time_zone represents all time zone transitions
for a specific geographic area[.](#time.zone.overview-1.sentence-1)
time_zone construction is unspecified,
and performed as part of database initialization[.](#time.zone.overview-1.sentence-2)
[*Note [1](#time.zone.overview-note-1)*:
const time_zone objects can be accessed
via functions such as locate_zone[.](#time.zone.overview-1.sentence-3)
— *end note*]
#### [30.11.5.2](#time.zone.members) Member functions [[time.zone.members]](time.zone.members)
[🔗](#lib:name,time_zone)
`string_view name() const noexcept;
`
[1](#time.zone.members-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9443)
*Returns*: The name of the time_zone[.](#time.zone.members-1.sentence-1)
[2](#time.zone.members-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9447)
[*Example [1](#time.zone.members-example-1)*:
"America/New_York"[.](#time.zone.members-2.sentence-1)
— *end example*]
[🔗](#lib:get_info,time_zone)
`template<class Duration>
sys_info get_info(const sys_time<Duration>& st) const;
`
[3](#time.zone.members-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)[.](#time.zone.members-3.sentence-1)
[🔗](#lib:get_info,time_zone_)
`template<class Duration>
local_info get_info(const local_time<Duration>& tp) const;
`
[4](#time.zone.members-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9473)
*Returns*: A local_info for tp[.](#time.zone.members-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](#time.zone.members-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[.](#time.zone.members-5.sentence-1)
This sys_time is the UTC equivalent of tp according to the rules of this time_zone[.](#time.zone.members-5.sentence-2)
[6](#time.zone.members-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[.](#time.zone.members-6.sentence-1)
If the tp represents a non-existent time between two UTC time_points,
throws nonexistent_local_time[.](#time.zone.members-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](#time.zone.members-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[.](#time.zone.members-7.sentence-1)
This sys_time is the UTC equivalent of tp according to the rules of this time_zone[.](#time.zone.members-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[.](#time.zone.members-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[.](#time.zone.members-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](#time.zone.members-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9531)
*Returns*: The local_time associated with tp and this time_zone[.](#time.zone.members-8.sentence-1)
#### [30.11.5.3](#time.zone.nonmembers) Non-member functions [[time.zone.nonmembers]](time.zone.nonmembers)
[🔗](#lib:operator==,time_zone)
`bool operator==(const time_zone& x, const time_zone& y) noexcept;
`
[1](#time.zone.nonmembers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9544)
*Returns*: x.name() == y.name()[.](#time.zone.nonmembers-1.sentence-1)
[🔗](#lib:operator%3c=%3e,time_zone)
`strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept;
`
[2](#time.zone.nonmembers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9555)
*Returns*: x.name() <=> y.name()[.](#time.zone.nonmembers-2.sentence-1)

View File

@@ -0,0 +1,516 @@
[time.zone.zonedtime]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#zonedtime)
### 30.11.7 Class template zoned_time [time.zone.zonedtime]
#### [30.11.7.1](#overview) Overview [[time.zone.zonedtime.overview]](time.zone.zonedtime.overview)
namespace std::chrono {template<class Duration, class TimeZonePtr = const time_zone*>class zoned_time {public:using duration = common_type_t<Duration, seconds>; private: TimeZonePtr zone_; // *exposition only* sys_time<duration> tp_; // *exposition only*using traits = zoned_traits<TimeZonePtr>; // *exposition only*public: zoned_time();
zoned_time(const zoned_time&) = default;
zoned_time& operator=(const zoned_time&) = default;
zoned_time(const sys_time<Duration>& st); explicit zoned_time(TimeZonePtr z); explicit zoned_time(string_view name); template<class Duration2> zoned_time(const zoned_time<Duration2, TimeZonePtr>& y);
zoned_time(TimeZonePtr z, const sys_time<Duration>& st);
zoned_time(string_view name, const sys_time<Duration>& st);
zoned_time(TimeZonePtr z, const local_time<Duration>& tp);
zoned_time(string_view name, const local_time<Duration>& tp);
zoned_time(TimeZonePtr z, const local_time<Duration>& tp, choose c);
zoned_time(string_view name, const local_time<Duration>& tp, choose c); template<class Duration2, class TimeZonePtr2> zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y); template<class Duration2, class TimeZonePtr2> zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y, choose); template<class Duration2, class TimeZonePtr2> zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y); template<class Duration2, class TimeZonePtr2> zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y, choose c);
zoned_time& operator=(const sys_time<Duration>& st);
zoned_time& operator=(const local_time<Duration>& lt); operator sys_time<duration>() const; explicit operator local_time<duration>() const;
TimeZonePtr get_time_zone() const;
local_time<duration> get_local_time() const;
sys_time<duration> get_sys_time() const;
sys_info get_info() const; };
zoned_time() -> zoned_time<seconds>; template<class Duration> zoned_time(sys_time<Duration>)-> zoned_time<common_type_t<Duration, seconds>>; template<class TimeZonePtrOrName>using *time-zone-representation* = // *exposition only* conditional_t<is_convertible_v<TimeZonePtrOrName, string_view>, const time_zone*,
remove_cvref_t<TimeZonePtrOrName>>; template<class TimeZonePtrOrName> zoned_time(TimeZonePtrOrName&&)-> zoned_time<seconds, *time-zone-representation*<TimeZonePtrOrName>>; template<class TimeZonePtrOrName, class Duration> zoned_time(TimeZonePtrOrName&&, sys_time<Duration>)-> zoned_time<common_type_t<Duration, seconds>, *time-zone-representation*<TimeZonePtrOrName>>; template<class TimeZonePtrOrName, class Duration> zoned_time(TimeZonePtrOrName&&, local_time<Duration>,
choose = choose::earliest)-> zoned_time<common_type_t<Duration, seconds>, *time-zone-representation*<TimeZonePtrOrName>>; template<class Duration, class TimeZonePtrOrName, class TimeZonePtr2> zoned_time(TimeZonePtrOrName&&, zoned_time<Duration, TimeZonePtr2>,
choose = choose::earliest)-> zoned_time<common_type_t<Duration, seconds>, *time-zone-representation*<TimeZonePtrOrName>>;}
[1](#overview-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9701)
zoned_time represents a logical pairing of
a time_zone and a time_point with precision Duration[.](#overview-1.sentence-1)
zoned_time<Duration> maintains the invariant that
it always refers to a valid time zone and
represents a point in time that exists and is not ambiguous
in that time zone[.](#overview-1.sentence-2)
[2](#overview-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9709)
If Duration is not a specialization of chrono::duration,
the program is ill-formed[.](#overview-2.sentence-1)
[3](#overview-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9713)
Every constructor of zoned_time that
accepts a string_view as its first parameter
does not participate in
class template argument deduction ([[over.match.class.deduct]](over.match.class.deduct "12.2.2.9Class template argument deduction"))[.](#overview-3.sentence-1)
#### [30.11.7.2](#ctor) Constructors [[time.zone.zonedtime.ctor]](time.zone.zonedtime.ctor)
[🔗](#lib:zoned_time,constructor)
`zoned_time();
`
[1](#ctor-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9727)
*Constraints*: traits::default_zone() is a well-formed expression[.](#ctor-1.sentence-1)
[2](#ctor-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9731)
*Effects*: Initializes zone_ with traits::default_zone() and
default constructs tp_[.](#ctor-2.sentence-1)
[🔗](#ctor-itemdecl:2)
`zoned_time(const sys_time<Duration>& st);
`
[3](#ctor-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9742)
*Constraints*: traits::default_zone() is a well-formed expression[.](#ctor-3.sentence-1)
[4](#ctor-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9746)
*Effects*: Initializes zone_ with traits::default_zone() and tp_ with st[.](#ctor-4.sentence-1)
[🔗](#ctor-itemdecl:3)
`explicit zoned_time(TimeZonePtr z);
`
[5](#ctor-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9756)
*Preconditions*: z refers to a time zone[.](#ctor-5.sentence-1)
[6](#ctor-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9760)
*Effects*: Initializes zone_ with std::move(z) and
default constructs tp_[.](#ctor-6.sentence-1)
[🔗](#ctor-itemdecl:4)
`explicit zoned_time(string_view name);
`
[7](#ctor-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9771)
*Constraints*: traits::locate_zone(string_view{}) is a well-formed expression andzoned_time is constructible from the return type of traits::locate_zone(string_view{})[.](#ctor-7.sentence-1)
[8](#ctor-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9776)
*Effects*: Initializes zone_ with traits::locate_zone(name) and
default constructs tp_[.](#ctor-8.sentence-1)
[🔗](#ctor-itemdecl:5)
`template<class Duration2>
zoned_time(const zoned_time<Duration2, TimeZonePtr>& y);
`
[9](#ctor-9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9788)
*Constraints*: is_convertible_v<sys_time<Duration2>, sys_time<Duration>> is true[.](#ctor-9.sentence-1)
[10](#ctor-10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9792)
*Effects*: Initializes zone_ with y.zone_ and tp_ with y.tp_[.](#ctor-10.sentence-1)
[🔗](#ctor-itemdecl:6)
`zoned_time(TimeZonePtr z, const sys_time<Duration>& st);
`
[11](#ctor-11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9802)
*Preconditions*: z refers to a time zone[.](#ctor-11.sentence-1)
[12](#ctor-12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9806)
*Effects*: Initializes zone_ with std::move(z) and tp_ with st[.](#ctor-12.sentence-1)
[🔗](#ctor-itemdecl:7)
`zoned_time(string_view name, const sys_time<Duration>& st);
`
[13](#ctor-13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9816)
*Constraints*: zoned_time is constructible from the return type of traits::locate_zone(name) and st[.](#ctor-13.sentence-1)
[14](#ctor-14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9820)
*Effects*: Equivalent to construction with {traits::locate_zone(name), st}[.](#ctor-14.sentence-1)
[🔗](#ctor-itemdecl:8)
`zoned_time(TimeZonePtr z, const local_time<Duration>& tp);
`
[15](#ctor-15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9830)
*Constraints*: is_convertible_v<decltype(declval<TimeZonePtr&>()->to_sys(local_time<Duration>{})),
sys_time<duration>> is true[.](#ctor-15.sentence-1)
[16](#ctor-16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9839)
*Preconditions*: z refers to a time zone[.](#ctor-16.sentence-1)
[17](#ctor-17)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9843)
*Effects*: Initializes zone_ with std::move(z) and tp_ with zone_->to_sys(tp)[.](#ctor-17.sentence-1)
[🔗](#ctor-itemdecl:9)
`zoned_time(string_view name, const local_time<Duration>& tp);
`
[18](#ctor-18)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9853)
*Constraints*: zoned_time is constructible from the return type of traits::locate_zone(name) and tp[.](#ctor-18.sentence-1)
[19](#ctor-19)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9857)
*Effects*: Equivalent to construction with {traits::locate_zone(name), tp}[.](#ctor-19.sentence-1)
[🔗](#ctor-itemdecl:10)
`zoned_time(TimeZonePtr z, const local_time<Duration>& tp, choose c);
`
[20](#ctor-20)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9867)
*Constraints*: is_convertible_v<decltype(declval<TimeZonePtr&>()->to_sys(local_time<Duration>{}, choose::earliest)),
sys_time<duration>> is true[.](#ctor-20.sentence-1)
[21](#ctor-21)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9876)
*Preconditions*: z refers to a time zone[.](#ctor-21.sentence-1)
[22](#ctor-22)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9880)
*Effects*: Initializes zone_ with std::move(z) and tp_ with zone_->to_sys(tp, c)[.](#ctor-22.sentence-1)
[🔗](#ctor-itemdecl:11)
`zoned_time(string_view name, const local_time<Duration>& tp, choose c);
`
[23](#ctor-23)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9890)
*Constraints*: zoned_time is constructible from
the return type of traits::locate_zone(name), local_time<Duration>, and choose[.](#ctor-23.sentence-1)
[24](#ctor-24)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9895)
*Effects*: Equivalent to construction with {traits::locate_zone(name), tp, c}[.](#ctor-24.sentence-1)
[🔗](#ctor-itemdecl:12)
`template<class Duration2, class TimeZonePtr2>
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y);
`
[25](#ctor-25)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9906)
*Constraints*: is_convertible_v<sys_time<Duration2>, sys_time<Duration>> is true[.](#ctor-25.sentence-1)
[26](#ctor-26)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9910)
*Preconditions*: z refers to a valid time zone[.](#ctor-26.sentence-1)
[27](#ctor-27)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9914)
*Effects*: Initializes zone_ with std::move(z) and tp_ with y.tp_[.](#ctor-27.sentence-1)
[🔗](#ctor-itemdecl:13)
`template<class Duration2, class TimeZonePtr2>
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y, choose);
`
[28](#ctor-28)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9925)
*Constraints*: is_convertible_v<sys_time<Duration2>, sys_time<Duration>> is true[.](#ctor-28.sentence-1)
[29](#ctor-29)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9929)
*Preconditions*: z refers to a valid time zone[.](#ctor-29.sentence-1)
[30](#ctor-30)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9933)
*Effects*: Equivalent to construction with {z, y}[.](#ctor-30.sentence-1)
[31](#ctor-31)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9937)
[*Note [1](#ctor-note-1)*:
The choose parameter has no effect[.](#ctor-31.sentence-1)
— *end note*]
[🔗](#ctor-itemdecl:14)
`template<class Duration2, class TimeZonePtr2>
zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y);
`
[32](#ctor-32)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9949)
*Constraints*: zoned_time is constructible from
the return type of traits::locate_zone(name) and
the type zoned_time<Duration2, TimeZonePtr2>[.](#ctor-32.sentence-1)
[33](#ctor-33)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9955)
*Effects*: Equivalent to construction with {traits::locate_zone(name), y}[.](#ctor-33.sentence-1)
[🔗](#ctor-itemdecl:15)
`template<class Duration2, class TimeZonePtr2>
zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y, choose c);
`
[34](#ctor-34)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9966)
*Constraints*: zoned_time is constructible from
the return type of traits::locate_zone(name),
the type zoned_time<Duration2, TimeZonePtr2>, and
the type choose[.](#ctor-34.sentence-1)
[35](#ctor-35)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9973)
*Effects*: Equivalent to construction with {traits::locate_zone(name), y, c}[.](#ctor-35.sentence-1)
[36](#ctor-36)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9977)
[*Note [2](#ctor-note-2)*:
The choose parameter has no effect[.](#ctor-36.sentence-1)
— *end note*]
#### [30.11.7.3](#members) Member functions [[time.zone.zonedtime.members]](time.zone.zonedtime.members)
[🔗](#lib:operator=,zoned_time)
`zoned_time& operator=(const sys_time<Duration>& st);
`
[1](#members-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9992)
*Effects*: After assignment, get_sys_time() == st[.](#members-1.sentence-1)
This assignment has no effect on the return value of get_time_zone()[.](#members-1.sentence-2)
[2](#members-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9997)
*Returns*: *this[.](#members-2.sentence-1)
[🔗](#lib:operator=,zoned_time_)
`zoned_time& operator=(const local_time<Duration>& lt);
`
[3](#members-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10008)
*Effects*: After assignment, get_local_time() == lt[.](#members-3.sentence-1)
This assignment has no effect on the return value of get_time_zone()[.](#members-3.sentence-2)
[4](#members-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10013)
*Returns*: *this[.](#members-4.sentence-1)
[🔗](#lib:operator_sys_time,zoned_time)
`operator sys_time<duration>() const;
`
[5](#members-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10024)
*Returns*: get_sys_time()[.](#members-5.sentence-1)
[🔗](#lib:operator_local_time,zoned_time)
`explicit operator local_time<duration>() const;
`
[6](#members-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10035)
*Returns*: get_local_time()[.](#members-6.sentence-1)
[🔗](#lib:get_time_zone,zoned_time)
`TimeZonePtr get_time_zone() const;
`
[7](#members-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10046)
*Returns*: zone_[.](#members-7.sentence-1)
[🔗](#lib:get_local_time,zoned_time)
`local_time<duration> get_local_time() const;
`
[8](#members-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10057)
*Returns*: zone_->to_local(tp_)[.](#members-8.sentence-1)
[🔗](#lib:get_sys_time,zoned_time)
`sys_time<duration> get_sys_time() const;
`
[9](#members-9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10068)
*Returns*: tp_[.](#members-9.sentence-1)
[🔗](#lib:get_info,zoned_time)
`sys_info get_info() const;
`
[10](#members-10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10079)
*Returns*: zone_->get_info(tp_)[.](#members-10.sentence-1)
#### [30.11.7.4](#nonmembers) Non-member functions [[time.zone.zonedtime.nonmembers]](time.zone.zonedtime.nonmembers)
[🔗](#lib:operator==,zoned_time)
`template<class Duration1, class Duration2, class TimeZonePtr>
bool operator==(const zoned_time<Duration1, TimeZonePtr>& x,
const zoned_time<Duration2, TimeZonePtr>& y);
`
[1](#nonmembers-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10094)
*Returns*: x.zone_ == y.zone_ && x.tp_ == y.tp_[.](#nonmembers-1.sentence-1)
[🔗](#lib:operator%3c%3c,zoned_time)
`template<class charT, class traits, class Duration, class TimeZonePtr>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os,
const zoned_time<Duration, TimeZonePtr>& t);
`
[2](#nonmembers-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10108)
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T %Z}"), t);

View File

@@ -0,0 +1,324 @@
[time.zone.zonedtime.ctor]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#zonedtime.ctor)
### 30.11.7 Class template zoned_time [[time.zone.zonedtime]](time.zone.zonedtime#ctor)
#### 30.11.7.2 Constructors [time.zone.zonedtime.ctor]
[🔗](#lib:zoned_time,constructor)
`zoned_time();
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9727)
*Constraints*: traits::default_zone() is a well-formed expression[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9731)
*Effects*: Initializes zone_ with traits::default_zone() and
default constructs tp_[.](#2.sentence-1)
[🔗](#itemdecl:2)
`zoned_time(const sys_time<Duration>& st);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9742)
*Constraints*: traits::default_zone() is a well-formed expression[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9746)
*Effects*: Initializes zone_ with traits::default_zone() and tp_ with st[.](#4.sentence-1)
[🔗](#itemdecl:3)
`explicit zoned_time(TimeZonePtr z);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9756)
*Preconditions*: z refers to a time zone[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9760)
*Effects*: Initializes zone_ with std::move(z) and
default constructs tp_[.](#6.sentence-1)
[🔗](#itemdecl:4)
`explicit zoned_time(string_view name);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9771)
*Constraints*: traits::locate_zone(string_view{}) is a well-formed expression andzoned_time is constructible from the return type of traits::locate_zone(string_view{})[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9776)
*Effects*: Initializes zone_ with traits::locate_zone(name) and
default constructs tp_[.](#8.sentence-1)
[🔗](#itemdecl:5)
`template<class Duration2>
zoned_time(const zoned_time<Duration2, TimeZonePtr>& y);
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9788)
*Constraints*: is_convertible_v<sys_time<Duration2>, sys_time<Duration>> is true[.](#9.sentence-1)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9792)
*Effects*: Initializes zone_ with y.zone_ and tp_ with y.tp_[.](#10.sentence-1)
[🔗](#itemdecl:6)
`zoned_time(TimeZonePtr z, const sys_time<Duration>& st);
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9802)
*Preconditions*: z refers to a time zone[.](#11.sentence-1)
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9806)
*Effects*: Initializes zone_ with std::move(z) and tp_ with st[.](#12.sentence-1)
[🔗](#itemdecl:7)
`zoned_time(string_view name, const sys_time<Duration>& st);
`
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9816)
*Constraints*: zoned_time is constructible from the return type of traits::locate_zone(name) and st[.](#13.sentence-1)
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9820)
*Effects*: Equivalent to construction with {traits::locate_zone(name), st}[.](#14.sentence-1)
[🔗](#itemdecl:8)
`zoned_time(TimeZonePtr z, const local_time<Duration>& tp);
`
[15](#15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9830)
*Constraints*: is_convertible_v<decltype(declval<TimeZonePtr&>()->to_sys(local_time<Duration>{})),
sys_time<duration>> is true[.](#15.sentence-1)
[16](#16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9839)
*Preconditions*: z refers to a time zone[.](#16.sentence-1)
[17](#17)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9843)
*Effects*: Initializes zone_ with std::move(z) and tp_ with zone_->to_sys(tp)[.](#17.sentence-1)
[🔗](#itemdecl:9)
`zoned_time(string_view name, const local_time<Duration>& tp);
`
[18](#18)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9853)
*Constraints*: zoned_time is constructible from the return type of traits::locate_zone(name) and tp[.](#18.sentence-1)
[19](#19)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9857)
*Effects*: Equivalent to construction with {traits::locate_zone(name), tp}[.](#19.sentence-1)
[🔗](#itemdecl:10)
`zoned_time(TimeZonePtr z, const local_time<Duration>& tp, choose c);
`
[20](#20)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9867)
*Constraints*: is_convertible_v<decltype(declval<TimeZonePtr&>()->to_sys(local_time<Duration>{}, choose::earliest)),
sys_time<duration>> is true[.](#20.sentence-1)
[21](#21)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9876)
*Preconditions*: z refers to a time zone[.](#21.sentence-1)
[22](#22)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9880)
*Effects*: Initializes zone_ with std::move(z) and tp_ with zone_->to_sys(tp, c)[.](#22.sentence-1)
[🔗](#itemdecl:11)
`zoned_time(string_view name, const local_time<Duration>& tp, choose c);
`
[23](#23)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9890)
*Constraints*: zoned_time is constructible from
the return type of traits::locate_zone(name), local_time<Duration>, and choose[.](#23.sentence-1)
[24](#24)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9895)
*Effects*: Equivalent to construction with {traits::locate_zone(name), tp, c}[.](#24.sentence-1)
[🔗](#itemdecl:12)
`template<class Duration2, class TimeZonePtr2>
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y);
`
[25](#25)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9906)
*Constraints*: is_convertible_v<sys_time<Duration2>, sys_time<Duration>> is true[.](#25.sentence-1)
[26](#26)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9910)
*Preconditions*: z refers to a valid time zone[.](#26.sentence-1)
[27](#27)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9914)
*Effects*: Initializes zone_ with std::move(z) and tp_ with y.tp_[.](#27.sentence-1)
[🔗](#itemdecl:13)
`template<class Duration2, class TimeZonePtr2>
zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y, choose);
`
[28](#28)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9925)
*Constraints*: is_convertible_v<sys_time<Duration2>, sys_time<Duration>> is true[.](#28.sentence-1)
[29](#29)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9929)
*Preconditions*: z refers to a valid time zone[.](#29.sentence-1)
[30](#30)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9933)
*Effects*: Equivalent to construction with {z, y}[.](#30.sentence-1)
[31](#31)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9937)
[*Note [1](#note-1)*:
The choose parameter has no effect[.](#31.sentence-1)
— *end note*]
[🔗](#itemdecl:14)
`template<class Duration2, class TimeZonePtr2>
zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y);
`
[32](#32)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9949)
*Constraints*: zoned_time is constructible from
the return type of traits::locate_zone(name) and
the type zoned_time<Duration2, TimeZonePtr2>[.](#32.sentence-1)
[33](#33)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9955)
*Effects*: Equivalent to construction with {traits::locate_zone(name), y}[.](#33.sentence-1)
[🔗](#itemdecl:15)
`template<class Duration2, class TimeZonePtr2>
zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y, choose c);
`
[34](#34)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9966)
*Constraints*: zoned_time is constructible from
the return type of traits::locate_zone(name),
the type zoned_time<Duration2, TimeZonePtr2>, and
the type choose[.](#34.sentence-1)
[35](#35)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9973)
*Effects*: Equivalent to construction with {traits::locate_zone(name), y, c}[.](#35.sentence-1)
[36](#36)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9977)
[*Note [2](#note-2)*:
The choose parameter has no effect[.](#36.sentence-1)
— *end note*]

View File

@@ -0,0 +1,113 @@
[time.zone.zonedtime.members]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#zonedtime.members)
### 30.11.7 Class template zoned_time [[time.zone.zonedtime]](time.zone.zonedtime#members)
#### 30.11.7.3 Member functions [time.zone.zonedtime.members]
[🔗](#lib:operator=,zoned_time)
`zoned_time& operator=(const sys_time<Duration>& st);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9992)
*Effects*: After assignment, get_sys_time() == st[.](#1.sentence-1)
This assignment has no effect on the return value of get_time_zone()[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9997)
*Returns*: *this[.](#2.sentence-1)
[🔗](#lib:operator=,zoned_time_)
`zoned_time& operator=(const local_time<Duration>& lt);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10008)
*Effects*: After assignment, get_local_time() == lt[.](#3.sentence-1)
This assignment has no effect on the return value of get_time_zone()[.](#3.sentence-2)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10013)
*Returns*: *this[.](#4.sentence-1)
[🔗](#lib:operator_sys_time,zoned_time)
`operator sys_time<duration>() const;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10024)
*Returns*: get_sys_time()[.](#5.sentence-1)
[🔗](#lib:operator_local_time,zoned_time)
`explicit operator local_time<duration>() const;
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10035)
*Returns*: get_local_time()[.](#6.sentence-1)
[🔗](#lib:get_time_zone,zoned_time)
`TimeZonePtr get_time_zone() const;
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10046)
*Returns*: zone_[.](#7.sentence-1)
[🔗](#lib:get_local_time,zoned_time)
`local_time<duration> get_local_time() const;
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10057)
*Returns*: zone_->to_local(tp_)[.](#8.sentence-1)
[🔗](#lib:get_sys_time,zoned_time)
`sys_time<duration> get_sys_time() const;
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10068)
*Returns*: tp_[.](#9.sentence-1)
[🔗](#lib:get_info,zoned_time)
`sys_info get_info() const;
`
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10079)
*Returns*: zone_->get_info(tp_)[.](#10.sentence-1)

View File

@@ -0,0 +1,36 @@
[time.zone.zonedtime.nonmembers]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#zonedtime.nonmembers)
### 30.11.7 Class template zoned_time [[time.zone.zonedtime]](time.zone.zonedtime#nonmembers)
#### 30.11.7.4 Non-member functions [time.zone.zonedtime.nonmembers]
[🔗](#lib:operator==,zoned_time)
`template<class Duration1, class Duration2, class TimeZonePtr>
bool operator==(const zoned_time<Duration1, TimeZonePtr>& x,
const zoned_time<Duration2, TimeZonePtr>& y);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10094)
*Returns*: x.zone_ == y.zone_ && x.tp_ == y.tp_[.](#1.sentence-1)
[🔗](#lib:operator%3c%3c,zoned_time)
`template<class charT, class traits, class Duration, class TimeZonePtr>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os,
const zoned_time<Duration, TimeZonePtr>& t);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L10108)
*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L%F %T %Z}"), t);

View File

@@ -0,0 +1,64 @@
[time.zone.zonedtime.overview]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#zonedtime.overview)
### 30.11.7 Class template zoned_time [[time.zone.zonedtime]](time.zone.zonedtime#overview)
#### 30.11.7.1 Overview [time.zone.zonedtime.overview]
namespace std::chrono {template<class Duration, class TimeZonePtr = const time_zone*>class zoned_time {public:using duration = common_type_t<Duration, seconds>; private: TimeZonePtr zone_; // *exposition only* sys_time<duration> tp_; // *exposition only*using traits = zoned_traits<TimeZonePtr>; // *exposition only*public: zoned_time();
zoned_time(const zoned_time&) = default;
zoned_time& operator=(const zoned_time&) = default;
zoned_time(const sys_time<Duration>& st); explicit zoned_time(TimeZonePtr z); explicit zoned_time(string_view name); template<class Duration2> zoned_time(const zoned_time<Duration2, TimeZonePtr>& y);
zoned_time(TimeZonePtr z, const sys_time<Duration>& st);
zoned_time(string_view name, const sys_time<Duration>& st);
zoned_time(TimeZonePtr z, const local_time<Duration>& tp);
zoned_time(string_view name, const local_time<Duration>& tp);
zoned_time(TimeZonePtr z, const local_time<Duration>& tp, choose c);
zoned_time(string_view name, const local_time<Duration>& tp, choose c); template<class Duration2, class TimeZonePtr2> zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y); template<class Duration2, class TimeZonePtr2> zoned_time(TimeZonePtr z, const zoned_time<Duration2, TimeZonePtr2>& y, choose); template<class Duration2, class TimeZonePtr2> zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y); template<class Duration2, class TimeZonePtr2> zoned_time(string_view name, const zoned_time<Duration2, TimeZonePtr2>& y, choose c);
zoned_time& operator=(const sys_time<Duration>& st);
zoned_time& operator=(const local_time<Duration>& lt); operator sys_time<duration>() const; explicit operator local_time<duration>() const;
TimeZonePtr get_time_zone() const;
local_time<duration> get_local_time() const;
sys_time<duration> get_sys_time() const;
sys_info get_info() const; };
zoned_time() -> zoned_time<seconds>; template<class Duration> zoned_time(sys_time<Duration>)-> zoned_time<common_type_t<Duration, seconds>>; template<class TimeZonePtrOrName>using *time-zone-representation* = // *exposition only* conditional_t<is_convertible_v<TimeZonePtrOrName, string_view>, const time_zone*,
remove_cvref_t<TimeZonePtrOrName>>; template<class TimeZonePtrOrName> zoned_time(TimeZonePtrOrName&&)-> zoned_time<seconds, *time-zone-representation*<TimeZonePtrOrName>>; template<class TimeZonePtrOrName, class Duration> zoned_time(TimeZonePtrOrName&&, sys_time<Duration>)-> zoned_time<common_type_t<Duration, seconds>, *time-zone-representation*<TimeZonePtrOrName>>; template<class TimeZonePtrOrName, class Duration> zoned_time(TimeZonePtrOrName&&, local_time<Duration>,
choose = choose::earliest)-> zoned_time<common_type_t<Duration, seconds>, *time-zone-representation*<TimeZonePtrOrName>>; template<class Duration, class TimeZonePtrOrName, class TimeZonePtr2> zoned_time(TimeZonePtrOrName&&, zoned_time<Duration, TimeZonePtr2>,
choose = choose::earliest)-> zoned_time<common_type_t<Duration, seconds>, *time-zone-representation*<TimeZonePtrOrName>>;}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9701)
zoned_time represents a logical pairing of
a time_zone and a time_point with precision Duration[.](#1.sentence-1)
zoned_time<Duration> maintains the invariant that
it always refers to a valid time zone and
represents a point in time that exists and is not ambiguous
in that time zone[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9709)
If Duration is not a specialization of chrono::duration,
the program is ill-formed[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9713)
Every constructor of zoned_time that
accepts a string_view as its first parameter
does not participate in
class template argument deduction ([[over.match.class.deduct]](over.match.class.deduct "12.2.2.9Class template argument deduction"))[.](#3.sentence-1)

View File

@@ -0,0 +1,41 @@
[time.zone.zonedtraits]
# 30 Time library [[time]](./#time)
## 30.11 Time zones [[time.zone]](time.zone#zonedtraits)
### 30.11.6 Class template zoned_traits [time.zone.zonedtraits]
namespace std::chrono {template<class T> struct zoned_traits {};}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9569)
zoned_traits provides a means for customizing
the behavior of zoned_time<Duration, TimeZonePtr> for the zoned_time default constructor,
and constructors taking string_view[.](#1.sentence-1)
A specialization for const time_zone* is provided by the implementation:namespace std::chrono {template<> struct zoned_traits<const time_zone*> {static const time_zone* default_zone(); static const time_zone* locate_zone(string_view name); };}
[🔗](#lib:default_zone,zoned_traits%3cconst_time_zone*%3e)
`static const time_zone* default_zone();
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9590)
*Returns*: std::chrono::locate_zone("UTC")[.](#2.sentence-1)
[🔗](#lib:locate_zone,zoned_traits%3cconst_time_zone*%3e)
`static const time_zone* locate_zone(string_view name);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L9601)
*Returns*: std::chrono::locate_zone(name)[.](#3.sentence-1)