27 Time library [time]

27.9 Class template time_­of_­day [time.tod]

27.9.2 Hours precision [time.tod.hours]

namespace std::chrono {
  template<>
  class time_of_day<hours> {
  public:
    using precision = chrono::hours;

    time_of_day() = default;
    constexpr explicit time_of_day(chrono::hours since_midnight) noexcept;

    constexpr chrono::hours hours() const noexcept;

    constexpr explicit operator  precision()   const noexcept;
    constexpr          precision to_duration() const noexcept;

    constexpr void make24() noexcept;
    constexpr void make12() noexcept;
  };
}
[Note
:
This specialization handles hours since midnight.
end note
]
constexpr explicit time_of_day(chrono::hours since_midnight) noexcept;
Effects: Constructs an object of type time_­of_­day in 24-hour format corresponding to since_­midnight hours after 00:00:00.
Ensures: hours() returns the integral number of hours since_­midnight is after 00:00:00.
constexpr chrono::hours hours() const noexcept;
Returns: The stored hour of *this.
constexpr explicit operator precision() const noexcept;
Returns: The number of hours since midnight.
constexpr precision to_duration() const noexcept;
Returns: precision{*this}.
constexpr void make24() noexcept;
Effects: If *this is a 12-hour time, converts to a 24-hour time.
Otherwise, no effects.
constexpr void make12() noexcept;
Effects: If *this is a 24-hour time, converts to a 12-hour time.
Otherwise, no effects.