Namespaces
Variants

std::chrono:: ambiguous_local_time

From cppreference.net
헤더 파일에 정의됨 <chrono>
class ambiguous_local_time ;
(C++20부터)

모호한 std::chrono::local_time std::chrono::choose (예: choose::earliest 또는 choose::latest )를 지정하지 않고 std::chrono::sys_time 으로 변환하려는 시도를 보고하기 위해 예외로 던져지는 객체 유형을 정의합니다.

이 예외는 std::chrono::time_zone::to_sys 와 이를 호출하는 함수들(예: std::chrono::zoned_time 의 생성자 중 std::chrono::local_time 를 취하는 생성자)에 의해 발생합니다.

cpp/error/exception cpp/error/runtime error std-chrono-ambiguous local time-inheritance.svg

상속 다이어그램

목차

멤버 함수

(constructor)
예외 객체를 생성합니다
(public member function)
operator=
예외 객체를 대체합니다
(public member function)
what
설명 문자열을 반환합니다
(public member function)

std::chrono::ambiguous_local_time:: ambiguous_local_time

template < class Duration >

ambiguous_local_time ( const std:: chrono :: local_time < Duration > & tp,

const std:: chrono :: local_info & i ) ;
(1) (since C++20)
ambiguous_local_time ( const ambiguous_local_time & other ) noexcept ;
(2) (since C++20)

예외 객체를 생성합니다.

1) what ( ) 이 반환하는 설명 문자열은 다음 코드 실행 후 os. str ( ) 이 생성하는 문자열과 동일합니다:
std::ostringstream os;
os << tp << " is ambiguous.  It could be\n"
   << tp << ' ' << i.first.abbrev << " == "
   << tp - i.first.offset << " UTC or\n"
   << tp << ' ' << i.second.abbrev  << " == "
   << tp - i.second.offset  << " UTC";
i. result ! = std :: chrono :: local_info :: ambiguous 인 경우 동작은 정의되지 않습니다.
2) 복사 생성자입니다. * this other 모두 동적 타입이 std::chrono::ambiguous_local_time 인 경우 std:: strcmp ( what ( ) , other. what ( ) ) == 0 입니다.

매개변수

tp - 변환을 시도한 시간 포인트
i - 변환 시도 결과를 설명하는 std::chrono::local_info
other - 복사할 다른 ambiguous_local_time 객체

예외

std::bad_alloc 을 던질 수 있습니다.

참고

std::exception 에서 파생된 표준 라이브러리 클래스를 복사하는 것은 예외를 던지는 것이 허용되지 않기 때문에, 이 메시지는 일반적으로 별도로 할당된 참조 카운트 문자열로 내부에 저장됩니다.

std::chrono::ambiguous_locale_time:: operator=

ambiguous_locale_time & operator = ( const ambiguous_locale_time & other ) noexcept ;
(C++20부터)

내용을 other 의 내용으로 할당합니다. * this other 모두 동적 타입 std::chrono::ambiguous_locale_time 를 가지는 경우, 할당 후 std:: strcmp ( what ( ) , other. what ( ) ) == 0 입니다.

매개변수

other - 할당할 다른 예외 객체

반환 값

* this

std::chrono::ambiguous_locale_time:: what

virtual const char * what ( ) const noexcept ;
(C++20부터)

설명 문자열을 반환합니다.

반환 값

설명 정보를 포함하는 구현 정의 널 종료 문자열에 대한 포인터. 이 문자열은 std::wstring 으로 변환 및 표시에 적합합니다. 이 포인터는 최소한 해당 예외 객체가 파괴되거나 예외 객체의 비상수 멤버 함수(예: 복사 할당 연산자)가 호출되기 전까지는 유효함이 보장됩니다.

참고

구현체는 what() 을 재정의할 수 있지만 필수는 아닙니다.

std:: runtime_error 에서 상속됨


std:: exception 로부터 상속됨

멤버 함수

[virtual]
예외 객체를 파괴함
( std::exception 의 virtual public 멤버 함수)
[virtual]
설명 문자열을 반환함
( std::exception 의 virtual public 멤버 함수)

참고 항목

존재하지 않는 지역 시간을 보고하기 위해 던져지는 예외
(클래스)