constexpr bool is_negative() const noexcept; | (1) | |
constexpr std::chrono::hours hours() const noexcept; | (2) | |
constexpr std::chrono::minutes minutes() const noexcept; | (3) | |
constexpr std::chrono::seconds seconds() const noexcept; | (4) | |
constexpr precision subseconds() const noexcept; | (5) |
Obtains the components of the stored "broken down" time.
Let d
be the represented duration:
true
if d
is negative, false
otherwise.std::chrono::duration_cast<std::chrono::hours>(abs(d))
.std::chrono::duration_cast<std::chrono::minutes>(abs(d) - hours())
.std::chrono::duration_cast<std::chrono::seconds>(abs(d) - hours() - minutes())
.abs(d) - hours() - minutes() - seconds()
if std::chrono::treat_as_floating_point_v<precision::rep>
is true; otherwise std::chrono::duration_cast<precision>(abs(d) - hours() - minutes() - seconds())
.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/chrono/hh_mm_ss/accessors