Add convenience converts among sys_time, utc_time, tai_time, and gps_time.

This commit is contained in:
Howard Hinnant 2016-06-08 20:49:03 -04:00
parent 58b08e0c74
commit 49f4ef0a2c

70
tz.html
View File

@ -26,7 +26,7 @@
<br/>
<br/>
<a href="mailto:howard.hinnant@gmail.com">Howard E. Hinnant</a><br/>
2016-06-07<br/>
2016-06-08<br/>
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"> <img alt="Creative
Commons License" style="border-width:0"
src="http://i.creativecommons.org/l/by/4.0/80x15.png" /></a><br /> This work is licensed
@ -2695,6 +2695,74 @@ operator&lt;&lt;(std::basic_ostream&lt;class CharT, class Traits&gt;&amp; os, co
</p>
</blockquote>
<p><b>Convenience converters</b></p>
<pre>
template &lt;class Duration&gt;
sys_time&lt;typename std::common_type&lt;Duration, std::chrono::seconds&gt;::type&gt;
to_sys_time(tai_time&lt;Duration&gt; t)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>to_sys_time(to_utc_time(t))</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt;
sys_time&lt;typename std::common_type&lt;Duration, std::chrono::seconds&gt;::type&gt;
to_sys_time(gps_time&lt;Duration&gt; t)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>to_sys_time(to_utc_time(t))</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt;
tai_time&lt;typename std::common_type&lt;Duration, std::chrono::seconds&gt;::type&gt;
to_tai_time(sys_time&lt;Duration&gt; t)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>to_tai_time(to_utc_time(t))</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt;
tai_time&lt;typename std::common_type&lt;Duration, std::chrono::seconds&gt;::type&gt;
to_tai_time(gps_time&lt;Duration&gt; t)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>to_tai_time(to_utc_time(t))</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt;
gps_time&lt;typename std::common_type&lt;Duration, std::chrono::seconds&gt;::type&gt;
to_gps_time(sys_time&lt;Duration&gt; t)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>to_gps_time(to_utc_time(t))</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt;
gps_time&lt;typename std::common_type&lt;Duration, std::chrono::seconds&gt;::type&gt;
to_gps_time(tai_time&lt;Duration&gt; t)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>to_gps_time(to_utc_time(t))</code>.
</p>
</blockquote>
<p>
[<i>Example:</i>
</p>