From Jason Turner

[time.zone.leap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpionx4ywe/{from.md → to.md} +168 -0
tmp/tmpionx4ywe/{from.md → to.md} RENAMED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class `leap_second` <a id="time.zone.leap">[[time.zone.leap]]</a>
2
+
3
+ #### Overview <a id="time.zone.leap.overview">[[time.zone.leap.overview]]</a>
4
+
5
+ ``` cpp
6
+ namespace std::chrono {
7
+ class leap_second {
8
+ public:
9
+ leap_second(const leap_second&) = default;
10
+ leap_second& operator=(const leap_second&) = default;
11
+
12
+ // unspecified additional constructors
13
+
14
+ constexpr sys_seconds date() const noexcept;
15
+ constexpr seconds value() const noexcept;
16
+ };
17
+ }
18
+ ```
19
+
20
+ Objects of type `leap_second` representing the date and value of the
21
+ leap second insertions are constructed and stored in the time zone
22
+ database when initialized.
23
+
24
+ [*Example 1*:
25
+
26
+ ``` cpp
27
+ for (auto& l : get_tzdb().leap_seconds)
28
+ if (l <= 2018y/March/17d)
29
+ cout << l.date() << ": " << l.value() << '\n';
30
+ ```
31
+
32
+ Produces the output:
33
+
34
+ ``` cpp
35
+ 1972-07-01 00:00:00: 1s
36
+ 1973-01-01 00:00:00: 1s
37
+ 1974-01-01 00:00:00: 1s
38
+ 1975-01-01 00:00:00: 1s
39
+ 1976-01-01 00:00:00: 1s
40
+ 1977-01-01 00:00:00: 1s
41
+ 1978-01-01 00:00:00: 1s
42
+ 1979-01-01 00:00:00: 1s
43
+ 1980-01-01 00:00:00: 1s
44
+ 1981-07-01 00:00:00: 1s
45
+ 1982-07-01 00:00:00: 1s
46
+ 1983-07-01 00:00:00: 1s
47
+ 1985-07-01 00:00:00: 1s
48
+ 1988-01-01 00:00:00: 1s
49
+ 1990-01-01 00:00:00: 1s
50
+ 1991-01-01 00:00:00: 1s
51
+ 1992-07-01 00:00:00: 1s
52
+ 1993-07-01 00:00:00: 1s
53
+ 1994-07-01 00:00:00: 1s
54
+ 1996-01-01 00:00:00: 1s
55
+ 1997-07-01 00:00:00: 1s
56
+ 1999-01-01 00:00:00: 1s
57
+ 2006-01-01 00:00:00: 1s
58
+ 2009-01-01 00:00:00: 1s
59
+ 2012-07-01 00:00:00: 1s
60
+ 2015-07-01 00:00:00: 1s
61
+ 2017-01-01 00:00:00: 1s
62
+ ```
63
+
64
+ — *end example*]
65
+
66
+ #### Member functions <a id="time.zone.leap.members">[[time.zone.leap.members]]</a>
67
+
68
+ ``` cpp
69
+ constexpr sys_seconds date() const noexcept;
70
+ ```
71
+
72
+ *Returns:* The date and time at which the leap second was inserted.
73
+
74
+ ``` cpp
75
+ constexpr seconds value() const noexcept;
76
+ ```
77
+
78
+ *Returns:* `+1s` to indicate a positive leap second or `-1s` to indicate
79
+ a negative leap second.
80
+
81
+ [*Note 1*: All leap seconds inserted up through 2019 were positive leap
82
+ seconds. — *end note*]
83
+
84
+ #### Non-member functions <a id="time.zone.leap.nonmembers">[[time.zone.leap.nonmembers]]</a>
85
+
86
+ ``` cpp
87
+ constexpr bool operator==(const leap_second& x, const leap_second& y) noexcept;
88
+ ```
89
+
90
+ *Returns:* `x.date() == y.date()`.
91
+
92
+ ``` cpp
93
+ constexpr strong_ordering operator<=>(const leap_second& x, const leap_second& y) noexcept;
94
+ ```
95
+
96
+ *Returns:* `x.date() <=> y.date()`.
97
+
98
+ ``` cpp
99
+ template<class Duration>
100
+ constexpr bool operator==(const leap_second& x, const sys_time<Duration>& y) noexcept;
101
+ ```
102
+
103
+ *Returns:* `x.date() == y`.
104
+
105
+ ``` cpp
106
+ template<class Duration>
107
+ constexpr bool operator<(const leap_second& x, const sys_time<Duration>& y) noexcept;
108
+ ```
109
+
110
+ *Returns:* `x.date() < y`.
111
+
112
+ ``` cpp
113
+ template<class Duration>
114
+ constexpr bool operator<(const sys_time<Duration>& x, const leap_second& y) noexcept;
115
+ ```
116
+
117
+ *Returns:* `x < y.date()`.
118
+
119
+ ``` cpp
120
+ template<class Duration>
121
+ constexpr bool operator>(const leap_second& x, const sys_time<Duration>& y) noexcept;
122
+ ```
123
+
124
+ *Returns:* `y < x`.
125
+
126
+ ``` cpp
127
+ template<class Duration>
128
+ constexpr bool operator>(const sys_time<Duration>& x, const leap_second& y) noexcept;
129
+ ```
130
+
131
+ *Returns:* `y < x`.
132
+
133
+ ``` cpp
134
+ template<class Duration>
135
+ constexpr bool operator<=(const leap_second& x, const sys_time<Duration>& y) noexcept;
136
+ ```
137
+
138
+ *Returns:* `!(y < x)`.
139
+
140
+ ``` cpp
141
+ template<class Duration>
142
+ constexpr bool operator<=(const sys_time<Duration>& x, const leap_second& y) noexcept;
143
+ ```
144
+
145
+ *Returns:* `!(y < x)`.
146
+
147
+ ``` cpp
148
+ template<class Duration>
149
+ constexpr bool operator>=(const leap_second& x, const sys_time<Duration>& y) noexcept;
150
+ ```
151
+
152
+ *Returns:* `!(x < y)`.
153
+
154
+ ``` cpp
155
+ template<class Duration>
156
+ constexpr bool operator>=(const sys_time<Duration>& x, const leap_second& y) noexcept;
157
+ ```
158
+
159
+ *Returns:* `!(x < y)`.
160
+
161
+ ``` cpp
162
+ template<class Duration>
163
+ requires three_way_comparable_with<sys_seconds, sys_time<Duration>>
164
+ constexpr auto operator<=>(const leap_second& x, const sys_time<Duration>& y) noexcept;
165
+ ```
166
+
167
+ *Returns:* `x.date() <=> y`.
168
+