30
Time library
[time]
30.11
Time zones
[time.zone]
30.11.2
Time zone database
[time.zone.db]
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
#
Each
vector
in a
tzdb
object is sorted to enable fast lookup
.
🔗
const
time_zone
*
locate_zone
(
string_view tz_name
)
const
;
2
#
Returns
:
(2.1)
If
zones
contains an element
tz
for which
tz
.
name
(
)
=
=
tz_
name
, a pointer to
tz
;
(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
(
)
.
[
Note
1
:
A
time_
zone_
link
specifies an alternative name for a
time_
zone
.
—
end note
]
3
#
Throws
: If a
const
time_
zone
*
cannot be found as described in the
Returns
: element, throws a
runtime_
error
.
[
Note
2
:
On non-exceptional return, the return value is always a pointer to a valid
time_
zone
.
—
end note
]
🔗
const
time_zone
*
current_zone
(
)
const
;
4
#
Returns
: A pointer to the time zone which the computer has set as its local time zone
.