名稱空間
變體
操作

std::chrono::tai_clock

來自 cppreference.com
< cpp‎ | chrono
 
 
 
 
定義於標頭檔案 <chrono>
class tai_clock;
(C++20 起)

時鐘 std::chrono::tai_clock 是一個表示 國際原子時 (TAI) 的 時鐘。它測量自 1958 年 1 月 1 日 00:00:00 以來的時間,在該日期比 UTC 提前 10 秒(即,它的紀元,1958-01-01 00:00:00 TAI,是 1957-12-31 23:59:50 UTC)。

閏秒不會插入到 TAI 中。因此,每當閏秒插入到 UTC 中時,UTC 就會比 TAI 再落後一秒。截至 2017 年 12 月,UTC 比 TAI 落後 37 秒,這反映了 10 秒的初始偏移和 1958 年至 2017 年間插入的 27 個閏秒。因此,2018-01-01 00:00:00 UTC 等同於 2018-01-01 00:00:37 TAI。

tai_clock 滿足 Clock 要求。它不滿足 TrivialClock 要求,除非實現能夠保證 now() 不會丟擲異常。

目錄

時間點家族

定義在名稱空間 std::chrono
template<class Duration>
using tai_time = std::chrono::time_point<std::chrono::tai_clock, Duration>;
(C++20 起)
using tai_seconds = tai_time<std::chrono::seconds>;
(C++20 起)
tai_time 執行流輸出
(函式模板) [編輯]
根據提供的格式從流中解析 tai_time
(函式模板) [編輯]
tai_time 的格式化支援
(類模板特化) [編輯]

[編輯] 成員型別

成員型別 定義
rep 帶符號算術型別,表示時鐘持續時間內的“滴答”數
period 一個 std::ratio 型別,表示時鐘的“滴答”週期,以秒為單位
duration std::chrono::duration<rep, period>,能夠表示負持續時間
time_point std::chrono::time_point<std::chrono::tai_clock>

[編輯] 成員常量

constexpr bool is_steady
[靜態]
如果“滴答”之間的時間始終恆定,即對 now() 的呼叫返回即使在某些外部時鐘調整的情況下也單調遞增的值,則為 true,否則為 false
(public static 成員常量)

[編輯] 成員函式

[靜態]
返回表示當前時間點的 std::chrono::time_point
(公共靜態成員函式) [編輯]
[靜態]
tai_time 轉換為 utc_time
(公共靜態成員函式) [編輯]
[靜態]
utc_time 轉換為 tai_time
(公共靜態成員函式) [編輯]