chrono_current_zone
chrono_current_zone (현재 시간대)
std::chrono::current_zone는 시간대 데이터베이스에서 현재 로컬 시간대를 얻는 편의 함수예요.
출처: cppreference
본문
std::chrono::current_zone는 <chrono> 헤더에 정의된 함수예요. C++20부터 사용 가능해요.
const std::chrono::time_zone* current_zone();
시간대 데이터베이스(tz database)에서 현재 로컬 시간대를 얻어요. std::chrono::get_tzdb().current_zone()과 동등해요.
예외 (Exceptions)
이 함수 호출이 시간대 데이터베이스에 대한 첫 참조이고 데이터베이스를 초기화할 수 없으면 std::runtime_error를 던져요.
참고 (Notes)
시간대 데이터베이스에 대한 첫 참조인 호출은 데이터베이스를 초기화해요.
예제 (Example)
#include <chrono>
#include <iostream>
int main()
{
try
{
const std::chrono::time_zone* tz = std::chrono::current_zone();
std::cout << tz->name() << '\n';
}
catch (const std::exception& e)
{
std::cout << e.what() << '\n';
}
}