From c842fd0a1965fd24877eda62419094b067144a2f Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 23 Mar 2018 09:29:19 -0400 Subject: [PATCH] Clarify is_leap_second --- tz.html | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/tz.html b/tz.html index a6cbf96..b1e4f31 100644 --- a/tz.html +++ b/tz.html @@ -2824,15 +2824,51 @@ is_leap_second(utc_time<Duration> const& t);

-Returns: If t represents a time_point during a leap -second insertion, the first member of the pair has a value of +Returns: Given a list of leap second insertion dates li since +1970-01-01, +if t is in the range [li, li + 1s), +the first member of the pair has a value of true, otherwise false. The second member of the returned pair holds the number of leap seconds that have been inserted between t and 1970-01-01. If t represents a time_point -prior to 1970-01-01, the value is 0s. If t represents a -time_point during a leap second insertion, that full leap second is included +prior to 1970-01-01, the value is 0s. If t is in the range +[li, li + 1s), li is included in the count.

+

+[Example: +

+
+cout << boolalpha;
+
+auto t = clock_cast<utc_clock>(sys_days{December/31/2016} + 23h + 59min + 59s + 999ms);
+auto p = is_leap_second(t);
+cout << t << " : {" << p.first << ", " << p.second << "}\n";
+// 2016-12-31 23:59:59.999 : {false, 26s}
+
+t += 1ms;
+p = is_leap_second(t);
+cout << t << " : {" << p.first << ", " << p.second << "}\n";
+// 2016-12-31 23:59:60.000 : {true, 27s}
+
+t += 1ms;
+p = is_leap_second(t);
+cout << t << " : {" << p.first << ", " << p.second << "}\n";
+// 2016-12-31 23:59:60.001 : {true, 27s}
+
+t += 998ms;
+p = is_leap_second(t);
+cout << t << " : {" << p.first << ", " << p.second << "}\n";
+// 2016-12-31 23:59:60.999 : {true, 27s}
+
+t += 1ms;
+p = is_leap_second(t);
+cout << t << " : {" << p.first << ", " << p.second << "}\n";
+// 2017-01-01 00:00:00.000 : {false, 27s}
+
+

+—end example] +