forked from fmtlib/fmt
Document chrono
This commit is contained in:
@@ -421,15 +421,15 @@ For example::
|
|||||||
fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s);
|
fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s);
|
||||||
}
|
}
|
||||||
|
|
||||||
prints::
|
prints:
|
||||||
|
|
||||||
|
.. code:: none
|
||||||
|
|
||||||
Default format: 42s 100ms
|
Default format: 42s 100ms
|
||||||
strftime-like format: 03:15:30
|
strftime-like format: 03:15:30
|
||||||
|
|
||||||
Chrono format specifications are described in :ref:`chrono-specs`.
|
Chrono format specifications are described in :ref:`chrono-specs`.
|
||||||
|
|
||||||
.. doxygenclass:: formatter<std::chrono::time_point<std::chrono::system_clock>, Char>
|
|
||||||
|
|
||||||
.. _compile-api:
|
.. _compile-api:
|
||||||
|
|
||||||
Format string compilation
|
Format string compilation
|
||||||
|
@@ -319,13 +319,15 @@ Format specifications for chrono types have the following syntax:
|
|||||||
chrono_type: "a" | "A" | "b" | "B" | "c" | "C" | "d" | "D" | "e" | "F" |
|
chrono_type: "a" | "A" | "b" | "B" | "c" | "C" | "d" | "D" | "e" | "F" |
|
||||||
: "g" | "G" | "h" | "H" | "I" | "j" | "m" | "M" | "n" | "p" |
|
: "g" | "G" | "h" | "H" | "I" | "j" | "m" | "M" | "n" | "p" |
|
||||||
: "q" | "Q" | "r" | "R" | "S" | "t" | "T" | "u" | "U" | "V" |
|
: "q" | "Q" | "r" | "R" | "S" | "t" | "T" | "u" | "U" | "V" |
|
||||||
: "w" | "W" | "x" | "X" | "y" | "Y" | "z" | "Z" | "%" |
|
: "w" | "W" | "x" | "X" | "y" | "Y" | "z" | "Z" | "%"
|
||||||
|
|
||||||
Literal chars are copied unchanged to the output. Precision is valid only for
|
Literal chars are copied unchanged to the output. Precision is valid only for
|
||||||
``std::chrono::duration`` types with a floating-point representation type.
|
``std::chrono::duration`` types with a floating-point representation type.
|
||||||
|
|
||||||
*conversion_spec* are conversion specifiers documented in `strftime
|
*conversion_spec* are conversion specifiers documented in `strftime
|
||||||
<http://en.cppreference.com/w/cpp/chrono/c/strftime>`_.
|
<http://en.cppreference.com/w/cpp/chrono/c/strftime>`_. Specifiers that have a
|
||||||
|
calendaric component such as `'d'` are valid only for ``std::tm`` and not
|
||||||
|
durations or time points.
|
||||||
|
|
||||||
.. _formatexamples:
|
.. _formatexamples:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user