Search⌘ K
AI Features

Time Zones

Explore how to work with time zones and calendar dates in C++20 using the chrono library. Learn to use new types like zoned_time and clocks, parse time data, and manage local and UTC times while handling daylight saving changes and leap seconds.

First of all, a time zone is a region, and its full history of the date, such as daylight saving time or leap seconds. The time zone library in C++20 is a complete parser of the IANA timezone database. The following table should give you a first idea of the new functionality.

Type Description
std::chrono::tzdb Describes a copy of the IANA time-zone database
std::chrono::tzdb_list Represents a linked list of the tzdb
std::chrono::get_tzdb
std::chrono::get_tzdb_list
std::chrono::reload_tzdb
std::chrono::remote_version
Accesses and controls the global time-zone database
std::chrono::locate_zone Locates the time zone based on its name
std::chrono::current_zone Returns the current time zone
std::chrono::time_zone Represents a time zone
std::chrono::sys_info Represents information about a time zone at a specific time point
std::chrono::local_info Represents information about a local time to UNIX time conversion
std::chrono::zoned_traits Class for time zone pointers
std::chrono::zoned_time Represents a time zone and a time point
std::chrono::leap_second Contains information about a leap-second insertion
...