std::chrono::operator<< (std::chrono::time_of_day)

From cppreference.com
< cpp‎ | chrono‎ | time of day
 
 
 
Date and time utilities
(C++11)
(C++11)
Clocks
(C++20)
                                                  
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
Calendars
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
Time zones
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
C-style date and time
 
 
template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,

           const std::chrono::time_of_day<std::chrono::hours>& t);
(1)
template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,

           const std::chrono::time_of_day<std::chrono::minutes>& t);
(2)
template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,

           const std::chrono::time_of_day<std::chrono::seconds>& t);
(3)
template< class CharT, class Traits, class Rep, class Period >

std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,

           const std::chrono::time_of_day<std::chrono::duration<Rep, Period>>& t);
(4)

Outputs t into the stream os, according to the format string specified by the table below.

Overload 12-hour format 24-hour format
(1) "%I%p" "%H00"
(2) "%I:%M%p" "%H:%M"
(3-4) "%I:%M:%S%p" "%H:%M:%S"

The meaning of the format specifiers are:

Format
specifier
Explanation
%H Writes the hour (24-hour clock) as a decimal number. If the result is a single digit, it is prefixed with 0.
%I Writes the hour (12-hour clock) as a decimal number. If the result is a single digit, it is prefixed with 0.
%M Writes the minute as a decimal number. If the result is a single digit, it is prefixed with 0.
%S Writes the second as a decimal number. If the number of seconds is less than 10, the result is prefixed with 0.

If the precision of the input cannot be exactly represented with seconds, then the format is a decimal floating point number with a fixed format and a precision matching that of the precision of the input (or to a microseconds precision if the conversion to floating point decimal seconds cannot be made within 18 fractional digits). The character for the decimal point is localized according to the locale.

%p Writes the locale's equivalent of the AM/PM designations associated with a 12-hour clock.

Return value

os.