chrono_utc_clock
chrono_utc_clock (UTC 시계)
std::chrono::utc_clock는 UTC(협정 세계시)와 윤초를 나타내는 시계 타입이에요.
출처: cppreference
본문
std::chrono::utc_clock는 <chrono> 헤더에 정의된 클래스예요. C++20부터 사용 가능해요.
class utc_clock;
UTC 시간과 윤초(leap seconds)를 나타내는 시계예요. UTC는 시스템의 system_clock(Unix time)과 달리 윤초를 포함하는 실제 시간 척도예요. utc_time은 std::chrono::time_point<utc_clock, Duration> 타입이에요.
now(), to_sys/from_sys, to_tai/from_tai, to_gps/from_gps 등을 제공하고 std::chrono::is_clock<utc_clock>는 true예요.
예제 (Example)
#include <chrono>
#include <iostream>
int main()
{
auto ut = std::chrono::utc_clock::now();
auto st = std::chrono::utc_clock::to_sys(ut);
std::cout << st.time_since_epoch().count() << '\n';
}