namespace std::chrono { template<class Duration> class hh_mm_ss { public: static constexpr unsigned fractional_width = see below; using precision = see below; constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {} constexpr explicit hh_mm_ss(Duration d); constexpr bool is_negative() const noexcept; constexpr chrono::hours hours() const noexcept; constexpr chrono::minutes minutes() const noexcept; constexpr chrono::seconds seconds() const noexcept; constexpr precision subseconds() const noexcept; constexpr explicit operator precision() const noexcept; constexpr precision to_duration() const noexcept; private: bool is_neg; // exposition only chrono::hours h; // exposition only chrono::minutes m; // exposition only chrono::seconds s; // exposition only precision ss; // exposition only }; }
static constexpr unsigned fractional_width = see below;
Duration | fractional_width | Formatted fractional second output |
hours, minutes, and seconds | 0 | |
milliseconds | 3 | 0.001 |
microseconds | 6 | 0.000001 |
nanoseconds | 9 | 0.000000001 |
duration<int, ratio<1, 2>> | 1 | 0.5 |
duration<int, ratio<1, 3>> | 6 | 0.333333 |
duration<int, ratio<1, 4>> | 2 | 0.25 |
duration<int, ratio<1, 5>> | 1 | 0.2 |
duration<int, ratio<1, 6>> | 6 | 0.166666 |
duration<int, ratio<1, 7>> | 6 | 0.142857 |
duration<int, ratio<1, 8>> | 3 | 0.125 |
duration<int, ratio<1, 9>> | 6 | 0.111111 |
duration<int, ratio<1, 10>> | 1 | 0.1 |
duration<int, ratio<756, 625>> | 4 | 0.2096 |
using precision = see below;
constexpr explicit hh_mm_ss(Duration d);
constexpr bool is_negative() const noexcept;
constexpr chrono::hours hours() const noexcept;
constexpr chrono::minutes minutes() const noexcept;
constexpr chrono::seconds seconds() const noexcept;
constexpr precision subseconds() const noexcept;
constexpr precision to_duration() const noexcept;
constexpr explicit operator precision() const noexcept;
template<class charT, class traits, class Duration>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const hh_mm_ss<Duration>& hms);