forked from HowardHinnant/date
Add to_stream which avoids temporary streams and strings.
* This is a low-level formatting facility which other functions such as format call into.
This commit is contained in:
63
tz.html
63
tz.html
@@ -26,7 +26,7 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="mailto:howard.hinnant@gmail.com">Howard E. Hinnant</a><br/>
|
<a href="mailto:howard.hinnant@gmail.com">Howard E. Hinnant</a><br/>
|
||||||
2016-10-08<br/>
|
2016-11-25<br/>
|
||||||
</address>
|
</address>
|
||||||
<hr/>
|
<hr/>
|
||||||
<h1 align=center>Time Zone Database Parser</h1>
|
<h1 align=center>Time Zone Database Parser</h1>
|
||||||
@@ -57,6 +57,7 @@
|
|||||||
<li><a href="#time_zone"><code>time_zone</code></a></li>
|
<li><a href="#time_zone"><code>time_zone</code></a></li>
|
||||||
<li><a href="#zoned_time"><code>zoned_time</code></a></li>
|
<li><a href="#zoned_time"><code>zoned_time</code></a></li>
|
||||||
<li><a href="#make_zoned"><code>make_zoned</code></a></li>
|
<li><a href="#make_zoned"><code>make_zoned</code></a></li>
|
||||||
|
<li><a href="#to_stream"><code>to_stream</code></a></li>
|
||||||
<li><a href="#format"><code>format</code></a></li>
|
<li><a href="#format"><code>format</code></a></li>
|
||||||
<li><a href="#parse"><code>parse</code></a></li>
|
<li><a href="#parse"><code>parse</code></a></li>
|
||||||
<li><a href="#utc_clock"><code>utc_clock</code></a></li>
|
<li><a href="#utc_clock"><code>utc_clock</code></a></li>
|
||||||
@@ -1991,35 +1992,75 @@ make_zoned(const std::string& name, const sys_time<Duration>& st)
|
|||||||
|
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
<a name="to_stream"></a><h3><code>to_stream</code></h3>
|
||||||
|
<blockquote>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
template <class CharT, class Traits, class Duration>
|
||||||
|
void
|
||||||
|
to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
||||||
|
const local_time<Duration>& tp);
|
||||||
|
</pre>
|
||||||
|
<blockquote>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
template <class CharT, class Traits, class Duration>
|
||||||
|
void
|
||||||
|
to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
||||||
|
const sys_time<Duration>& tp);
|
||||||
|
</pre>
|
||||||
|
<blockquote>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
template <class CharT, class Traits, class Duration>
|
||||||
|
void
|
||||||
|
to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
||||||
|
const zoned_time<Duration>& tp);
|
||||||
|
</pre>
|
||||||
|
<blockquote>
|
||||||
|
<p>
|
||||||
|
These are lower-level functions with respect to <code>format</code>. These functions
|
||||||
|
will <i>format</i> directly to a <i>stream</i>. If you use these you will not be able
|
||||||
|
to align your formatted time stamp within a <code>width</code> respecting the stream's
|
||||||
|
<code>adjustfield</code>. But in forgoing that utility you may realize some performance
|
||||||
|
gains over <code>format</code> as nothing in the implementation of <code>to_stream</code>
|
||||||
|
creates temporary strings or streams to format into.
|
||||||
|
</p>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
<a name="format"></a><h3><code>format</code></h3>
|
<a name="format"></a><h3><code>format</code></h3>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>
|
<pre>
|
||||||
template <class CharT, class Traits, class Duration>
|
template <class CharT, class Traits, class Duration>
|
||||||
std::basic_string<class CharT, class Traits>
|
std::basic_string<class CharT, class Traits>
|
||||||
format(const std::locale& loc, std::basic_string<class CharT, class Traits> format,
|
format(const std::locale& loc, const std::basic_string<class CharT, class Traits>& format,
|
||||||
const local_time<Duration>& tp);
|
const local_time<Duration>& tp);
|
||||||
|
|
||||||
template <class CharT, class Traits, class Duration>
|
template <class CharT, class Traits, class Duration>
|
||||||
std::basic_string<class CharT, class Traits>
|
std::basic_string<class CharT, class Traits>
|
||||||
format(std::basic_string<class CharT, class Traits> format, const local_time<Duration>& tp);
|
format(const std::basic_string<class CharT, class Traits>& format, const local_time<Duration>& tp);
|
||||||
|
|
||||||
template <class CharT, class Traits, class Duration>
|
template <class CharT, class Traits, class Duration>
|
||||||
std::basic_string<class CharT, class Traits>
|
std::basic_string<class CharT, class Traits>
|
||||||
format(const std::locale& loc, std::basic_string<class CharT, class Traits> format,
|
format(const std::locale& loc, const std::basic_string<class CharT, class Traits>& format,
|
||||||
const zoned_time<Duration>& tp);
|
const zoned_time<Duration>& tp);
|
||||||
|
|
||||||
template <class CharT, class Traits, class Duration>
|
template <class CharT, class Traits, class Duration>
|
||||||
std::basic_string<class CharT, class Traits>
|
std::basic_string<class CharT, class Traits>
|
||||||
format(std::basic_string<class CharT, class Traits> format, const zoned_time<Duration>& tp);
|
format(const std::basic_string<class CharT, class Traits>& format, const zoned_time<Duration>& tp);
|
||||||
|
|
||||||
template <class CharT, class Traits, class Duration>
|
template <class CharT, class Traits, class Duration>
|
||||||
std::basic_string<class CharT, class Traits>
|
std::basic_string<class CharT, class Traits>
|
||||||
format(const std::locale& loc, std::basic_string<class CharT, class Traits> format,
|
format(const std::locale& loc, const std::basic_string<class CharT, class Traits>& format,
|
||||||
const sys_time<Duration>& tp);
|
const sys_time<Duration>& tp);
|
||||||
|
|
||||||
template <class CharT, class Traits, class Duration>
|
template <class CharT, class Traits, class Duration>
|
||||||
std::basic_string<class CharT, class Traits>
|
std::basic_string<class CharT, class Traits>
|
||||||
format(std::basic_string<class CharT, class Traits> format, const sys_time<Duration>& tp);
|
format(const std::basic_string<class CharT, class Traits>& format, const sys_time<Duration>& tp);
|
||||||
|
|
||||||
// const CharT* formats
|
// const CharT* formats
|
||||||
|
|
||||||
@@ -2067,10 +2108,12 @@ The <code>format</code> string follows the rules as specified for
|
|||||||
<ul>
|
<ul>
|
||||||
<li><p>
|
<li><p>
|
||||||
If <code>%S</code> or <code>%T</code> appears in the <code>format</code> string
|
If <code>%S</code> or <code>%T</code> appears in the <code>format</code> string
|
||||||
and the argument <code>tp</code> has precision finer than seconds, then seconds
|
and the argument <code>tp</code> has precision that can not be exactly represented
|
||||||
|
with seconds, then seconds
|
||||||
are formatted as a decimal floating point number with a fixed format and a
|
are formatted as a decimal floating point number with a fixed format and a
|
||||||
precision matching that of the precision of <code>tp</code>. The character for
|
precision matching that of the precision of <code>tp</code> (or to a microseconds precision
|
||||||
the decimal point is localized according to the <code>locale</code>.
|
if the conversion to floating point decimal seconds can not be made within 18 digits).
|
||||||
|
The character for the decimal point is localized according to the <code>locale</code>.
|
||||||
</p></li>
|
</p></li>
|
||||||
|
|
||||||
<li><p>
|
<li><p>
|
||||||
|
Reference in New Issue
Block a user