다음을 통해 공유


time_zone_link 클래스

에 대한 대체 이름을 지정합니다 time_zone.

구문

class time_zone_link;  // Since C++20

설명

time_zone_link 인스턴스는 표준 시간대 데이터베이스가 초기화될 때 만들어집니다. 직접 만들 수 없습니다. 이 항목의 끝에 있는 예제와 같이 인스턴스를 통해 get_tzdb().links가져옵니다.

이 형식에는 기본 이동 생성자 및 이동 할당 연산자가 있지만 이 형식에 대한 액세스만 const 제공되므로 복사할 수 없습니다. 이러한 함수를 사용하면 정의되지 않은 동작이 발생하므로 이동 생성자 및 대입 연산자가 여기에 나열되지 않습니다.

IANA 데이터베이스와의 차이점

Microsoft의 구현에서 표준 시간대 데이터는 IANA(Internet Assigned Numbers Authority) 표준 시간대 데이터베이스와 일부 경우에 다를 수 있습니다. 예를 들어 "America/Nuuk" (2020년 4월에 이름이 바뀐"America/Godthab")"America/Nuuk" 대신 "America/Godthab" 반환됩니다. 현재는 표준 시간대를 "Eastern War Time EWT" 제공하지 않습니다. 자세한 내용은 Microsoft STL GitHub 리포지토리의 문제 #1786 을 참조하세요.

멤버

공용 멤버 함수 및 함수 템플릿

이름 설명
name 표준 시간대의 대체 이름을 가져옵니다.
target 대체 이름 time_zonetime_zone_link 인 이름입니다.

비멤버

이름 설명
operator== time_zone_link 개체가 같은 name지 여부를 확인합니다. 이름은 target 같음 검사 일부가 아닙니다.
operator<=> 다른 time_zone_link에 대해 비교합니다time_zone_link. >, >=, <=, <, != 연산자는 컴파일러에 의해 합성됩니다. Left.name() <=> Right.name()을(를) 반환합니다.

요구 사항

헤더<chrono>:

표준 시간대 데이터는 Windows 10 버전 1903/19H1 이상 및 Windows Server 2022 이상에서만 사용할 수 있습니다.

네임스페이스:std::chrono

컴파일러 옵션:/std:c++latest

표준 시간대의 대체 이름을 가져옵니다.

string_view name() const noexcept;

대체 이름인 time_zonetime_zone_link 이름을 가져옵니다.

string_view target() const noexcept;  // Since C++20

다음 예제에서는 IANA 표준 시간대 데이터베이스time_zone_link 이름을 표시합니다.

// compile using: /std:c++latest
#include <iostream>
#include <chrono>

using namespace std::chrono;

int main()
{
    const auto& my_tzdb = get_tzdb(); // get the IANA time zone database
    auto& links = my_tzdb.links; // get the list of time_zone_links from the database
    std::for_each(links.begin(), links.end(), // display each time_zone_link name and target
        [](auto& l)
        {
            std::cout << "Name: " << l.name() << "Target" << l.target() << '\n';
        });

    return 0;
}
Name: ACT Target:Australia/Darwin
Name: AET Target:Australia/Sydney
Name: AGT Target:America/Buenos_Aires
Name: ART Target:Africa/Cairo
Name: AST Target:America/Anchorage
Name: Africa/Asmara Target:Africa/Asmera
Name: Africa/Timbuktu Target:Africa/Bamako
Name: America/Argentina/Buenos_Aires Target:America/Buenos_Aires
Name: America/Argentina/Catamarca Target:America/Catamarca
...
Name: Zulu Target:Etc/UTC

참고 항목

<chrono>
time_zone
헤더 파일 참조