From 34e83bcf846071f96745502a7402434030b109cd Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 16 Jun 2017 21:47:54 -0400 Subject: [PATCH] Fill out leaps specification --- d0355r3.html | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) diff --git a/d0355r3.html b/d0355r3.html index 62ec455..886295a 100644 --- a/d0355r3.html +++ b/d0355r3.html @@ -9879,6 +9879,8 @@ Add a new section 23.17.12.10 leap [time.timezone.leap]:
 class leap
 {
+    sys_seconds date_;  // exposition only
+
 public:
     leap(const leap&)            = default;
     leap& operator=(const leap&) = default;
@@ -9917,6 +9919,225 @@ insertion.  leap is equality and less-than comparable, both with it
 with sys_time<Duration>.
 

+

+[Example: +

+
+

+Here is the date of all of the leap second insertions at the time of this writing: +

+
+    for (auto& l : get_tzdb().leaps)
+        cout << l.date() << '\n';
+
+

+which outputs: +

+
+    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
+
+
+

+— end example] +

+ +
+sys_seconds leap::date() const
+
+
+

+Returns: date_. +

+
+ +
+bool operator==(const leap& x, const leap& y)
+
+
+

+Returns: x.date() == y.date(). +

+
+ +
+bool operator!=(const leap& x, const leap& y)
+
+
+

+Returns: !(x == y). +

+
+ +
+bool operator<(const leap& x, const leap& y)
+
+
+

+Returns: x.date() < y.date(). +

+
+ +
+bool operator>(const leap& x, const leap& y)
+
+
+

+Returns: y < x. +

+
+ +
+bool operator<=(const leap& x, const leap& y)
+
+
+

+Returns: !(y < x). +

+
+ +
+bool operator>=(const leap& x, const leap& y)
+
+
+

+Returns: !(x < y). +

+
+ +
+template <class Duration> bool operator==(const const leap& x, const sys_time<Duration>& y)
+
+
+

+Returns: x.date() == y. +

+
+ +
+template <class Duration> bool operator==(const sys_time<Duration>& x, const leap& y)
+
+
+

+Returns: y == x. +

+
+ +
+template <class Duration> bool operator!=(const leap& x, const sys_time<Duration>& y)
+
+
+

+Returns: !(x == y). +

+
+ +
+template <class Duration> bool operator!=(const sys_time<Duration>& x, const leap& y)
+
+
+

+Returns: !(x == y). +

+
+ +
+template <class Duration> bool operator< (const leap& x, const sys_time<Duration>& y)
+
+
+

+Returns: x.date() < y. +

+
+ +
+template <class Duration> bool operator< (const sys_time<Duration>& x, const leap& y)
+
+
+

+Returns: x < y.date(). +

+
+ +
+template <class Duration> bool operator> (const leap& x, const sys_time<Duration>& y)
+
+
+

+Returns: y < x. +

+
+ +
+template <class Duration> bool operator> (const sys_time<Duration>& x, const leap& y)
+
+
+

+Returns: y < x. +

+
+ +
+template <class Duration> bool operator<=(const leap& x, const sys_time<Duration>& y)
+
+
+

+Returns: !(y < x). +

+
+ +
+template <class Duration> bool operator<=(const sys_time<Duration>& x, const leap& y)
+
+
+

+Returns: !(y < x). +

+
+ +
+template <class Duration> bool operator>=(const leap& x, const sys_time<Duration>& y)
+
+
+

+Returns: !(x < y). +

+
+ +
+template <class Duration> bool operator>=(const sys_time<Duration>& x, const leap& y)
+
+
+

+Returns: !(x < y). +

+
+