A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://en.cppreference.com/w/cpp/../cpp/../cpp/../cpp/chrono/day/../duration/operator_ltlt.html below:

std::chrono::operator<< (std::chrono::duration) - cppreference.com

Inserts a textual representation of d into os.

Behaves as if it was implemented as

std::basic_ostringstream<CharT, Traits> s;
s.flags(os.flags());
s.imbue(os.getloc());
s.precision(os.precision());
s << d.count() << units_suffix; // see below
return os << s.str();

In other words, the stream flags, locale, and precision are determined by the stream, but any padding are determined using the entire output string.

The units_suffix is determined based on Period::type according to the following table.

For the last two rows of the table, num and den in the suffix are Period::type::num and Period::type::den formatted as a decimal number with no leading zeroes, respectively.

[edit] Return value

A reference to the stream, i.e., os.

[edit] Example

This example shows the output of std::chrono::operator<< when given a duration:

#include <chrono>
#include <iostream>
using namespace std::chrono_literals;
 
int main()
{
    constexpr auto duration = 123ms;
    std::cout << duration << '\n';
}

Output:

[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4