• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <chrono>

    std::chrono::tzdb_list::front

    const tzdb& front() const noexcept;
    

    概要

    先頭要素を取得する。

    このクラスの先頭要素は、ローカルに保持しているうち最新のタイムゾーンデータベースを意味する。

    戻り値

    先頭要素への参照を返す。

    備考

    • この操作はreload_tzdb()内での呼び出しに対してスレッドセーフとなっている

    例外

    投げない

    このクラスには1要素以上の要素が保持されることが定められているため、空にはならない。

    #include <iostream>
    #include <chrono>
    
    namespace chrono = std::chrono;
    
    int main()
    {
      const chrono::tzdb& tzdb = chrono::get_tzdb_list().front();
      const chrono::time_zone* tz = tzdb.locate_zone("Asia/Tokyo");
      std::cout << tz->name() << std::endl;
    }
    

    出力例

    Asia/Tokyo
    

    バージョン

    言語

    • C++20

    処理系