[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)
