tmp/tmpbbxvt5t4/{from.md → to.md}
RENAMED
|
@@ -2,38 +2,38 @@
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template <class Clock, class Duration = typename Clock::duration>
|
| 5 |
class time_point {
|
| 6 |
public:
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
private:
|
| 12 |
duration d_; // exposition only
|
| 13 |
|
| 14 |
public:
|
| 15 |
-
// [time.point.cons], construct
|
| 16 |
constexpr time_point(); // has value epoch
|
| 17 |
constexpr explicit time_point(const duration& d); // same as time_point() + d
|
| 18 |
template <class Duration2>
|
| 19 |
constexpr time_point(const time_point<clock, Duration2>& t);
|
| 20 |
|
| 21 |
-
// [time.point.observer], observer
|
| 22 |
constexpr duration time_since_epoch() const;
|
| 23 |
|
| 24 |
-
// [time.point.arithmetic], arithmetic
|
| 25 |
-
time_point& operator+=(const duration& d);
|
| 26 |
-
time_point& operator-=(const duration& d);
|
| 27 |
|
| 28 |
-
// [time.point.special], special values
|
| 29 |
static constexpr time_point min();
|
| 30 |
static constexpr time_point max();
|
| 31 |
};
|
| 32 |
```
|
| 33 |
|
| 34 |
-
`Clock` shall meet the Clock requirements ([[time.clock]]).
|
| 35 |
|
| 36 |
If `Duration` is not an instance of `duration`, the program is
|
| 37 |
ill-formed.
|
| 38 |
|
| 39 |
#### `time_point` constructors <a id="time.point.cons">[[time.point.cons]]</a>
|
|
@@ -73,22 +73,22 @@ constexpr duration time_since_epoch() const;
|
|
| 73 |
*Returns:* `d_`.
|
| 74 |
|
| 75 |
#### `time_point` arithmetic <a id="time.point.arithmetic">[[time.point.arithmetic]]</a>
|
| 76 |
|
| 77 |
``` cpp
|
| 78 |
-
time_point& operator+=(const duration& d);
|
| 79 |
```
|
| 80 |
|
| 81 |
-
*Effects:* `d_ += d`
|
| 82 |
|
| 83 |
*Returns:* `*this`.
|
| 84 |
|
| 85 |
``` cpp
|
| 86 |
-
time_point& operator-=(const duration& d);
|
| 87 |
```
|
| 88 |
|
| 89 |
-
*Effects:* `d_ -= d`
|
| 90 |
|
| 91 |
*Returns:* `*this`.
|
| 92 |
|
| 93 |
#### `time_point` special values <a id="time.point.special">[[time.point.special]]</a>
|
| 94 |
|
|
@@ -110,12 +110,12 @@ static constexpr time_point max();
|
|
| 110 |
template <class Clock, class Duration1, class Rep2, class Period2>
|
| 111 |
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
|
| 112 |
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
| 113 |
```
|
| 114 |
|
| 115 |
-
*Returns:* `CT(lhs.time_since_epoch() + rhs)`, where `CT` is the
|
| 116 |
-
the return value.
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
template <class Rep1, class Period1, class Clock, class Duration2>
|
| 120 |
constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
|
| 121 |
operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
|
|
@@ -127,11 +127,12 @@ template <class Rep1, class Period1, class Clock, class Duration2>
|
|
| 127 |
template <class Clock, class Duration1, class Rep2, class Period2>
|
| 128 |
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
|
| 129 |
operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
| 130 |
```
|
| 131 |
|
| 132 |
-
*Returns:* `lhs
|
|
|
|
| 133 |
|
| 134 |
``` cpp
|
| 135 |
template <class Clock, class Duration1, class Duration2>
|
| 136 |
constexpr common_type_t<Duration1, Duration2>
|
| 137 |
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
|
@@ -141,46 +142,52 @@ template <class Clock, class Duration1, class Duration2>
|
|
| 141 |
|
| 142 |
#### `time_point` comparisons <a id="time.point.comparisons">[[time.point.comparisons]]</a>
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
template <class Clock, class Duration1, class Duration2>
|
| 146 |
-
constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
|
|
|
|
| 147 |
```
|
| 148 |
|
| 149 |
*Returns:* `lhs.time_since_epoch() == rhs.time_since_epoch()`.
|
| 150 |
|
| 151 |
``` cpp
|
| 152 |
template <class Clock, class Duration1, class Duration2>
|
| 153 |
-
constexpr bool operator!=(const time_point<Clock, Duration1>& lhs,
|
|
|
|
| 154 |
```
|
| 155 |
|
| 156 |
*Returns:* `!(lhs == rhs)`.
|
| 157 |
|
| 158 |
``` cpp
|
| 159 |
template <class Clock, class Duration1, class Duration2>
|
| 160 |
-
constexpr bool operator<(const time_point<Clock, Duration1>& lhs,
|
|
|
|
| 161 |
```
|
| 162 |
|
| 163 |
*Returns:* `lhs.time_since_epoch() < rhs.time_since_epoch()`.
|
| 164 |
|
| 165 |
``` cpp
|
| 166 |
template <class Clock, class Duration1, class Duration2>
|
| 167 |
-
constexpr bool operator<=(const time_point<Clock, Duration1>& lhs,
|
|
|
|
| 168 |
```
|
| 169 |
|
| 170 |
*Returns:* `!(rhs < lhs)`.
|
| 171 |
|
| 172 |
``` cpp
|
| 173 |
template <class Clock, class Duration1, class Duration2>
|
| 174 |
-
constexpr bool operator>(const time_point<Clock, Duration1>& lhs,
|
|
|
|
| 175 |
```
|
| 176 |
|
| 177 |
*Returns:* `rhs < lhs`.
|
| 178 |
|
| 179 |
``` cpp
|
| 180 |
template <class Clock, class Duration1, class Duration2>
|
| 181 |
-
constexpr bool operator>=(const time_point<Clock, Duration1>& lhs,
|
|
|
|
| 182 |
```
|
| 183 |
|
| 184 |
*Returns:* `!(lhs < rhs)`.
|
| 185 |
|
| 186 |
#### `time_point_cast` <a id="time.point.cast">[[time.point.cast]]</a>
|
|
@@ -190,10 +197,50 @@ template <class ToDuration, class Clock, class Duration>
|
|
| 190 |
constexpr time_point<Clock, ToDuration>
|
| 191 |
time_point_cast(const time_point<Clock, Duration>& t);
|
| 192 |
```
|
| 193 |
|
| 194 |
*Remarks:* This function shall not participate in overload resolution
|
| 195 |
-
unless `ToDuration` is
|
| 196 |
|
| 197 |
*Returns:*
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
|
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template <class Clock, class Duration = typename Clock::duration>
|
| 5 |
class time_point {
|
| 6 |
public:
|
| 7 |
+
using clock = Clock;
|
| 8 |
+
using duration = Duration;
|
| 9 |
+
using rep = typename duration::rep;
|
| 10 |
+
using period = typename duration::period;
|
| 11 |
private:
|
| 12 |
duration d_; // exposition only
|
| 13 |
|
| 14 |
public:
|
| 15 |
+
// [time.point.cons], construct
|
| 16 |
constexpr time_point(); // has value epoch
|
| 17 |
constexpr explicit time_point(const duration& d); // same as time_point() + d
|
| 18 |
template <class Duration2>
|
| 19 |
constexpr time_point(const time_point<clock, Duration2>& t);
|
| 20 |
|
| 21 |
+
// [time.point.observer], observer
|
| 22 |
constexpr duration time_since_epoch() const;
|
| 23 |
|
| 24 |
+
// [time.point.arithmetic], arithmetic
|
| 25 |
+
constexpr time_point& operator+=(const duration& d);
|
| 26 |
+
constexpr time_point& operator-=(const duration& d);
|
| 27 |
|
| 28 |
+
// [time.point.special], special values
|
| 29 |
static constexpr time_point min();
|
| 30 |
static constexpr time_point max();
|
| 31 |
};
|
| 32 |
```
|
| 33 |
|
| 34 |
+
`Clock` shall meet the Clock requirements ([[time.clock.req]]).
|
| 35 |
|
| 36 |
If `Duration` is not an instance of `duration`, the program is
|
| 37 |
ill-formed.
|
| 38 |
|
| 39 |
#### `time_point` constructors <a id="time.point.cons">[[time.point.cons]]</a>
|
|
|
|
| 73 |
*Returns:* `d_`.
|
| 74 |
|
| 75 |
#### `time_point` arithmetic <a id="time.point.arithmetic">[[time.point.arithmetic]]</a>
|
| 76 |
|
| 77 |
``` cpp
|
| 78 |
+
constexpr time_point& operator+=(const duration& d);
|
| 79 |
```
|
| 80 |
|
| 81 |
+
*Effects:* As if by: `d_ += d;`
|
| 82 |
|
| 83 |
*Returns:* `*this`.
|
| 84 |
|
| 85 |
``` cpp
|
| 86 |
+
constexpr time_point& operator-=(const duration& d);
|
| 87 |
```
|
| 88 |
|
| 89 |
+
*Effects:* As if by: `d_ -= d;`
|
| 90 |
|
| 91 |
*Returns:* `*this`.
|
| 92 |
|
| 93 |
#### `time_point` special values <a id="time.point.special">[[time.point.special]]</a>
|
| 94 |
|
|
|
|
| 110 |
template <class Clock, class Duration1, class Rep2, class Period2>
|
| 111 |
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
|
| 112 |
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
| 113 |
```
|
| 114 |
|
| 115 |
+
*Returns:* *`CT`*`(lhs.time_since_epoch() + rhs)`, where *`CT`* is the
|
| 116 |
+
type of the return value.
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
template <class Rep1, class Period1, class Clock, class Duration2>
|
| 120 |
constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
|
| 121 |
operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
|
|
|
|
| 127 |
template <class Clock, class Duration1, class Rep2, class Period2>
|
| 128 |
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
|
| 129 |
operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
| 130 |
```
|
| 131 |
|
| 132 |
+
*Returns:* *`CT`*`(lhs.time_since_epoch() - rhs)`, where *`CT`* is the
|
| 133 |
+
type of the return value.
|
| 134 |
|
| 135 |
``` cpp
|
| 136 |
template <class Clock, class Duration1, class Duration2>
|
| 137 |
constexpr common_type_t<Duration1, Duration2>
|
| 138 |
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
|
|
|
| 142 |
|
| 143 |
#### `time_point` comparisons <a id="time.point.comparisons">[[time.point.comparisons]]</a>
|
| 144 |
|
| 145 |
``` cpp
|
| 146 |
template <class Clock, class Duration1, class Duration2>
|
| 147 |
+
constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
|
| 148 |
+
const time_point<Clock, Duration2>& rhs);
|
| 149 |
```
|
| 150 |
|
| 151 |
*Returns:* `lhs.time_since_epoch() == rhs.time_since_epoch()`.
|
| 152 |
|
| 153 |
``` cpp
|
| 154 |
template <class Clock, class Duration1, class Duration2>
|
| 155 |
+
constexpr bool operator!=(const time_point<Clock, Duration1>& lhs,
|
| 156 |
+
const time_point<Clock, Duration2>& rhs);
|
| 157 |
```
|
| 158 |
|
| 159 |
*Returns:* `!(lhs == rhs)`.
|
| 160 |
|
| 161 |
``` cpp
|
| 162 |
template <class Clock, class Duration1, class Duration2>
|
| 163 |
+
constexpr bool operator<(const time_point<Clock, Duration1>& lhs,
|
| 164 |
+
const time_point<Clock, Duration2>& rhs);
|
| 165 |
```
|
| 166 |
|
| 167 |
*Returns:* `lhs.time_since_epoch() < rhs.time_since_epoch()`.
|
| 168 |
|
| 169 |
``` cpp
|
| 170 |
template <class Clock, class Duration1, class Duration2>
|
| 171 |
+
constexpr bool operator<=(const time_point<Clock, Duration1>& lhs,
|
| 172 |
+
const time_point<Clock, Duration2>& rhs);
|
| 173 |
```
|
| 174 |
|
| 175 |
*Returns:* `!(rhs < lhs)`.
|
| 176 |
|
| 177 |
``` cpp
|
| 178 |
template <class Clock, class Duration1, class Duration2>
|
| 179 |
+
constexpr bool operator>(const time_point<Clock, Duration1>& lhs,
|
| 180 |
+
const time_point<Clock, Duration2>& rhs);
|
| 181 |
```
|
| 182 |
|
| 183 |
*Returns:* `rhs < lhs`.
|
| 184 |
|
| 185 |
``` cpp
|
| 186 |
template <class Clock, class Duration1, class Duration2>
|
| 187 |
+
constexpr bool operator>=(const time_point<Clock, Duration1>& lhs,
|
| 188 |
+
const time_point<Clock, Duration2>& rhs);
|
| 189 |
```
|
| 190 |
|
| 191 |
*Returns:* `!(lhs < rhs)`.
|
| 192 |
|
| 193 |
#### `time_point_cast` <a id="time.point.cast">[[time.point.cast]]</a>
|
|
|
|
| 197 |
constexpr time_point<Clock, ToDuration>
|
| 198 |
time_point_cast(const time_point<Clock, Duration>& t);
|
| 199 |
```
|
| 200 |
|
| 201 |
*Remarks:* This function shall not participate in overload resolution
|
| 202 |
+
unless `ToDuration` is a specialization of `duration`.
|
| 203 |
|
| 204 |
*Returns:*
|
| 205 |
+
|
| 206 |
+
``` cpp
|
| 207 |
+
time_point<Clock, ToDuration>(duration_cast<ToDuration>(t.time_since_epoch()))
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
``` cpp
|
| 211 |
+
template <class ToDuration, class Clock, class Duration>
|
| 212 |
+
constexpr time_point<Clock, ToDuration>
|
| 213 |
+
floor(const time_point<Clock, Duration>& tp);
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
*Remarks:* This function shall not participate in overload resolution
|
| 217 |
+
unless `ToDuration` is a specialization of `duration`.
|
| 218 |
+
|
| 219 |
+
*Returns:*
|
| 220 |
+
`time_point<Clock, ToDuration>(floor<ToDuration>(tp.time_since_epoch()))`.
|
| 221 |
+
|
| 222 |
+
``` cpp
|
| 223 |
+
template <class ToDuration, class Clock, class Duration>
|
| 224 |
+
constexpr time_point<Clock, ToDuration>
|
| 225 |
+
ceil(const time_point<Clock, Duration>& tp);
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
*Remarks:* This function shall not participate in overload resolution
|
| 229 |
+
unless `ToDuration` is a specialization of `duration`.
|
| 230 |
+
|
| 231 |
+
*Returns:*
|
| 232 |
+
`time_point<Clock, ToDuration>(ceil<ToDuration>(tp.time_since_epoch()))`.
|
| 233 |
+
|
| 234 |
+
``` cpp
|
| 235 |
+
template <class ToDuration, class Clock, class Duration>
|
| 236 |
+
constexpr time_point<Clock, ToDuration>
|
| 237 |
+
round(const time_point<Clock, Duration>& tp);
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
*Remarks:* This function shall not participate in overload resolution
|
| 241 |
+
unless `ToDuration` is a specialization of `duration`, and
|
| 242 |
+
`treat_as_floating_point_v<typename ToDuration::rep>` is `false`.
|
| 243 |
+
|
| 244 |
+
*Returns:*
|
| 245 |
+
`time_point<Clock, ToDuration>(round<ToDuration>(tp.time_since_epoch()))`.
|
| 246 |
|