Fill out leaps specification

This commit is contained in:
Howard Hinnant 2017-06-16 21:47:54 -04:00
parent 09f16d53a2
commit 34e83bcf84

View File

@ -9879,6 +9879,8 @@ Add a new section 23.17.12.10 leap [time.timezone.leap]:
<pre>
class leap
{
sys_seconds date_; // exposition only
public:
leap(const leap&amp;) = default;
leap&amp; operator=(const leap&amp;) = default;
@ -9917,6 +9919,225 @@ insertion. <code>leap</code> is equality and less-than comparable, both with it
with <code>sys_time&lt;Duration&gt;</code>.
</p>
<p>
[<i>Example:</i>
</p>
<blockquote>
<p>
Here is the date of all of the leap second insertions at the time of this writing:
</p>
<pre>
for (auto&amp; l : get_tzdb().leaps)
cout &lt;&lt; l.date() &lt;&lt; '\n';
</pre>
<p>
which outputs:
</p>
<pre>
1972-07-01 00:00:00
1973-01-01 00:00:00
1974-01-01 00:00:00
1975-01-01 00:00:00
1976-01-01 00:00:00
1977-01-01 00:00:00
1978-01-01 00:00:00
1979-01-01 00:00:00
1980-01-01 00:00:00
1981-07-01 00:00:00
1982-07-01 00:00:00
1983-07-01 00:00:00
1985-07-01 00:00:00
1988-01-01 00:00:00
1990-01-01 00:00:00
1991-01-01 00:00:00
1992-07-01 00:00:00
1993-07-01 00:00:00
1994-07-01 00:00:00
1996-01-01 00:00:00
1997-07-01 00:00:00
1999-01-01 00:00:00
2006-01-01 00:00:00
2009-01-01 00:00:00
2012-07-01 00:00:00
2015-07-01 00:00:00
2017-01-01 00:00:00
</pre>
</blockquote>
<p>
&mdash; <i>end example</i>]
</p>
<pre>
sys_seconds leap::date() const
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>date_</code>.
</p>
</blockquote>
<pre>
bool operator==(const leap&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>x.date() == y.date()</code>.
</p>
</blockquote>
<pre>
bool operator!=(const leap&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(x == y)</code>.
</p>
</blockquote>
<pre>
bool operator&lt;(const leap&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>x.date() &lt; y.date()</code>.
</p>
</blockquote>
<pre>
bool operator&gt;(const leap&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>y &lt; x</code>.
</p>
</blockquote>
<pre>
bool operator&lt;=(const leap&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(y &lt; x)</code>.
</p>
</blockquote>
<pre>
bool operator&gt;=(const leap&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(x &lt; y)</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator==(const const leap&amp; x, const sys_time&lt;Duration&gt;&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>x.date() == y</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator==(const sys_time&lt;Duration&gt;&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>y == x</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator!=(const leap&amp; x, const sys_time&lt;Duration&gt;&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(x == y)</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator!=(const sys_time&lt;Duration&gt;&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(x == y)</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator&lt; (const leap&amp; x, const sys_time&lt;Duration&gt;&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>x.date() &lt; y</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator&lt; (const sys_time&lt;Duration&gt;&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>x &lt; y.date()</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator&gt; (const leap&amp; x, const sys_time&lt;Duration&gt;&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>y &lt; x</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator&gt; (const sys_time&lt;Duration&gt;&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>y &lt; x</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator&lt;=(const leap&amp; x, const sys_time&lt;Duration&gt;&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(y &lt; x)</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator&lt;=(const sys_time&lt;Duration&gt;&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(y &lt; x)</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator&gt;=(const leap&amp; x, const sys_time&lt;Duration&gt;&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(x &lt; y)</code>.
</p>
</blockquote>
<pre>
template &lt;class Duration&gt; bool operator&gt;=(const sys_time&lt;Duration&gt;&amp; x, const leap&amp; y)
</pre>
<blockquote>
<p>
<i>Returns:</i> <code>!(x &lt; y)</code>.
</p>
</blockquote>
</blockquote>
<p class = note>