• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <chrono>

    std::chrono::hh_mm_ss::seconds

    constexpr chrono::seconds seconds() const noexcept; // (1) C++20
    

    概要

    秒フィールドを取得する。

    戻り値

    コンストラクタで設定された秒を返す。

    #include <cassert>
    #include <chrono>
    
    namespace chrono = std::chrono;
    using namespace std::chrono_literals;
    
    int main()
    {
      chrono::hh_mm_ss time{-(15h + 30min + 20s)};
      assert(time.seconds() == 20s);
    }
    

    出力

    バージョン

    言語

    • C++20

    処理系