std::chrono::time_of_day (3) - Linux Manuals

std::chrono::time_of_day: std::chrono::time_of_day

NAME

std::chrono::time_of_day - std::chrono::time_of_day

Synopsis


Defined in header <chrono>
template< class Duration > (1) (since C++20)
class time_of_day; // not defined
template<> (2) (since C++20)
class time_of_day<std::chrono::hours>;
template<> (3) (since C++20)
class time_of_day<std::chrono::minutes>;
template<> (4) (since C++20)
class time_of_day<std::chrono::seconds>;
template< class Rep, class Period > (5) (since C++20)
class time_of_day<std::chrono::duration<Rep, Period>>;


The class template time_of_day splits a std::chrono::duration representing time since midnight into a "broken down" time such as hours:minutes:seconds, with the precision of the split determined by the Duration template parameter. It also tracks whether it should be output in a 12-hour time format or a 24-hour time format. It is primarily a formatting tool.
The primary template (1) is not defined; four specializations are provided to handle four different levels of precision.
Each specialization of time_of_day is a TriviallyCopyable StandardLayoutType.
The partial specialization (5) only exists if std::chrono::treat_as_floating_point_v<Rep> is false and std::chrono::duration<Rep, Period> is not convertible to std::chrono::seconds.

Member types


Member type Definition
precision Duration

Member functions


                   constructs a time_of_day
constructor (public member function)


hours accesses components of the broken-down time
minutes (public member function)
seconds
subseconds
                   accesses the stored std::chrono::duration
operator_precision (public member function)
to_duration
                   changes the time format used for output
make12 (public member function)
make24


Nonmember functions


           outputs a time_of_day into a stream
operator<< (function template)