std::chrono::current_zone

Header: <chrono>

Convenience function for obtaining local time zone from the time zone database. Equivalent to std::chrono::get_tzdb().current_zone().

# Declarations

const std::chrono::time_zone* current_zone();

(since C++20)

# Notes

A call to this function that is the first reference to the time zone database will cause it to be initialized.

# Example

#include <chrono>
#include <iostream>
 
int main() {
    const std::chrono::zoned_time cur_time{ std::chrono::current_zone(),
                                            std::chrono::system_clock::now() };
    std::cout << cur_time << '\n';
}

# See also