constexpr precision subseconds() 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 + 123ms)};
assert(time.subseconds() == 123ms);
}
xxxxxxxxxx
#include <cassert>
#include <chrono>
namespace chrono = std::chrono;
using namespace std::chrono_literals;
int main()
{
chrono::hh_mm_ss time{-(15h + 30min + 20s + 123ms)};
assert(time.subseconds() == 123ms);
}
出力
バージョン
言語
- C++20
処理系
- Clang: 10.0 ✅
- GCC: 11.1 ✅
- Visual C++: 2019 Update 3 ❌