W3cubDocs

/C++

std::chrono::time_of_day

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

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
(public member function)
accesses components of the broken-down time
(public member function)
accesses the stored std::chrono::duration
(public member function)
changes the time format used for output
(public member function)

Nonmember functions

outputs a time_of_day into a stream
(function template)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/chrono/time_of_day