chrono_nonexistent_local_time

chrono_nonexistent_local_time (존재하지 않는 로컬 시간 예외)

std::chrono::nonexistent_local_time은 존재하지 않는 로컬 시간을 UTC로 변환하려 할 때 던져지는 예외 타입이에요.

출처: cppreference

본문

std::chrono::nonexistent_local_time<chrono> 헤더에 정의된 예외 타입이에요. C++20부터 사용 가능해요.

template< class Duration >
nonexistent_local_time( const std::chrono::local_time<Duration>& tp,
                        const std::chrono::local_info& i );

존재하지 않는 std::chrono::local_time(예: DST 전환으로 건너뛰는 시간)을 std::chrono::sys_time으로 변환하려 할 때 이를 보고하기 위해 던져지는 예외 객체를 정의해요.

이 예외는 std::chrono::time_zone::to_sys와 그를 호출하는 함수들에서 던져져요.

상속

std::runtime_error에서 파생돼요.

예제 (Example)

#include <chrono>
#include <iostream>

int main()
{
    using namespace std::chrono;
    try
    {
        // ... 존재하지 않는 local_time을 to_sys로 변환
    }
    catch (const std::chrono::nonexistent_local_time& e)
    {
        std::cout << e.what() << '\n';
    }
}

더 알아보기 (Learn more)

cppreference