다음을 통해 공유


sys_info 구조체

표준 시간대 정보에 대한 하위 수준 인터페이스를 제공합니다.

구문

struct sys_info;

설명

로 변환한 결과에 대한 표준 시간대 정보에 대한 하위 수준 인터페이스를 sys_timelocal_time제공합니다.

멤버

함수 설명
abbrev 연결된 time_zonetime_point에 사용되는 약어입니다.
begin, end 연결된 표준 시간대에 offsetabbrev 적용할 범위입니다.
offset 연결된 및 에 대해 적용되는 UTC(Universal Time Coordinated time_zonetime_point) 오프셋입니다.
save 일광 절약 시간 조정 오프셋입니다.

비멤버

함수 설명
operator<< 스트림에 출력 sys_info 합니다.

abbrev

연결된 time_zonetime_point에 사용되는 약어입니다.

string abbrev;

반환 값

약어입니다.

설명

약어는 고유하지 않습니다 time_zone. 즉, 약어를 다시 및 UTC 오프셋에 안정적으로 time_zone 매핑할 수 없습니다.

begin, end

연결된 표준 시간대에 대한 범위를 제공하며, [begin, end)이 범위는 해당 표준 시간대에 offsetabbrev 적용됩니다.

sys_seconds begin;
sys_seconds end;

반환 값

반환 sys_seconds 되는 오프셋은 연결된 time_point오프셋을 기준으로 합니다.

offset

연결된 표준 시간대 및 time_point에 적용되는 UTC 오프셋입니다.

seconds offset;

반환 값

사이의 local_timesys_time 관계는 다음과 offset = local_time - sys_time같습니다.

save

일광 절약 시간제에 있는지 여부를 sys_info 나타내며, 이 경우 일광 절약 시간이 아닌 경우 이 표준 시간대에서 사용할 수 있는 오프셋을 제안합니다.

minutes save;

반환 값

이면 save != 0min표준 시간대가 연결된 일광 절약 시간제에 있습니다 time_point. 이 경우 offset-save 일광 절약 시간이 아닌 경우 사용할 수 있는 오프셋 time_zone 을 제안합니다.

이 오프셋은 신뢰할 수 없습니다. 신뢰할 수 있는 오프셋을 얻으려면 일광 절약 시간 동안 떨어지지 않는 표준 시간대를 사용하여 time_point 쿼리와 비교합니다. 즉, 값이 0인 time_point 결과와 save 비교합니다.

예: get a sys_info

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

using namespace std::chrono;

int main()
{
    sys_time<system_clock::duration> st = system_clock::now();
    
    const auto& timeZoneDatabase = get_tzdb();
    const auto& currentZone = timeZoneDatabase.current_zone();
    auto sysInfo = currentZone->get_info(st);

    std::cout << sysInfo << "\n";

    return 0;
}
begin: 2021-03-14 10:00:00, end: 2021-11-07 09:00:00, offset: -25200s, save: 60min, abbrev: PDT

요구 사항

헤더:<chrono>

네임스페이스:std::chrono

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

<chrono>
file_clock class
high_resolution_clock
local_t 구조체
system_clock 구조체
tai_clock 클래스
utc_clock 클래스
헤더 파일 참조