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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### `time_point` conversions <a id="time.clock.cast">[[time.clock.cast]]</a>
|
| 2 |
+
|
| 3 |
+
#### Class template `clock_time_conversion` <a id="time.clock.conv">[[time.clock.conv]]</a>
|
| 4 |
+
|
| 5 |
+
``` cpp
|
| 6 |
+
namespace std::chrono {
|
| 7 |
+
template<class DestClock, class SourceClock>
|
| 8 |
+
struct clock_time_conversion {};
|
| 9 |
+
}
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
`clock_time_conversion` serves as a trait which can be used to specify
|
| 13 |
+
how to convert a source `time_point` of type
|
| 14 |
+
`time_point<SourceClock, Duration>` to a destination `time_point` of
|
| 15 |
+
type `time_point<DestClock, Duration>` via a specialization:
|
| 16 |
+
`clock_time_conversion<DestClock, SourceClock>`. A specialization of
|
| 17 |
+
`clock_time_conversion<DestClock, SourceClock>` shall provide a
|
| 18 |
+
const-qualified `operator()` that takes a parameter of type
|
| 19 |
+
`time_point<SourceClock, Duration>` and returns a
|
| 20 |
+
`time_point<DestClock, OtherDuration>` representing an equivalent point
|
| 21 |
+
in time. `OtherDuration` is a `chrono::duration` whose specialization is
|
| 22 |
+
computed from the input `Duration` in a manner which can vary for each
|
| 23 |
+
`clock_time_conversion` specialization. A program may specialize
|
| 24 |
+
`clock_time_conversion` if at least one of the template parameters is a
|
| 25 |
+
user-defined clock type.
|
| 26 |
+
|
| 27 |
+
Several specializations are provided by the implementation, as described
|
| 28 |
+
in [[time.clock.cast.id]], [[time.clock.cast.sys.utc]],
|
| 29 |
+
[[time.clock.cast.sys]], and [[time.clock.cast.utc]].
|
| 30 |
+
|
| 31 |
+
#### Identity conversions <a id="time.clock.cast.id">[[time.clock.cast.id]]</a>
|
| 32 |
+
|
| 33 |
+
``` cpp
|
| 34 |
+
template<class Clock>
|
| 35 |
+
struct clock_time_conversion<Clock, Clock> {
|
| 36 |
+
template<class Duration>
|
| 37 |
+
time_point<Clock, Duration>
|
| 38 |
+
operator()(const time_point<Clock, Duration>& t) const;
|
| 39 |
+
};
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
``` cpp
|
| 43 |
+
template<class Duration>
|
| 44 |
+
time_point<Clock, Duration>
|
| 45 |
+
operator()(const time_point<Clock, Duration>& t) const;
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
*Returns:* `t`.
|
| 49 |
+
|
| 50 |
+
``` cpp
|
| 51 |
+
template<>
|
| 52 |
+
struct clock_time_conversion<system_clock, system_clock> {
|
| 53 |
+
template<class Duration>
|
| 54 |
+
sys_time<Duration>
|
| 55 |
+
operator()(const sys_time<Duration>& t) const;
|
| 56 |
+
};
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
``` cpp
|
| 60 |
+
template<class Duration>
|
| 61 |
+
sys_time<Duration>
|
| 62 |
+
operator()(const sys_time<Duration>& t) const;
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
*Returns:* `t`.
|
| 66 |
+
|
| 67 |
+
``` cpp
|
| 68 |
+
template<>
|
| 69 |
+
struct clock_time_conversion<utc_clock, utc_clock> {
|
| 70 |
+
template<class Duration>
|
| 71 |
+
utc_time<Duration>
|
| 72 |
+
operator()(const utc_time<Duration>& t) const;
|
| 73 |
+
};
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
``` cpp
|
| 77 |
+
template<class Duration>
|
| 78 |
+
utc_time<Duration>
|
| 79 |
+
operator()(const utc_time<Duration>& t) const;
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
*Returns:* `t`.
|
| 83 |
+
|
| 84 |
+
#### Conversions between `system_clock` and `utc_clock` <a id="time.clock.cast.sys.utc">[[time.clock.cast.sys.utc]]</a>
|
| 85 |
+
|
| 86 |
+
``` cpp
|
| 87 |
+
template<>
|
| 88 |
+
struct clock_time_conversion<utc_clock, system_clock> {
|
| 89 |
+
template<class Duration>
|
| 90 |
+
utc_time<common_type_t<Duration, seconds>>
|
| 91 |
+
operator()(const sys_time<Duration>& t) const;
|
| 92 |
+
};
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
``` cpp
|
| 96 |
+
template<class Duration>
|
| 97 |
+
utc_time<common_type_t<Duration, seconds>>
|
| 98 |
+
operator()(const sys_time<Duration>& t) const;
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
*Returns:* `utc_clock::from_sys(t)`.
|
| 102 |
+
|
| 103 |
+
``` cpp
|
| 104 |
+
template<>
|
| 105 |
+
struct clock_time_conversion<system_clock, utc_clock> {
|
| 106 |
+
template<class Duration>
|
| 107 |
+
sys_time<common_type_t<Duration, seconds>>
|
| 108 |
+
operator()(const utc_time<Duration>& t) const;
|
| 109 |
+
};
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
``` cpp
|
| 113 |
+
template<class Duration>
|
| 114 |
+
sys_time<common_type_t<Duration, seconds>>
|
| 115 |
+
operator()(const utc_time<Duration>& t) const;
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
*Returns:* `utc_clock::to_sys(t)`.
|
| 119 |
+
|
| 120 |
+
#### Conversions between `system_clock` and other clocks <a id="time.clock.cast.sys">[[time.clock.cast.sys]]</a>
|
| 121 |
+
|
| 122 |
+
``` cpp
|
| 123 |
+
template<class SourceClock>
|
| 124 |
+
struct clock_time_conversion<system_clock, SourceClock> {
|
| 125 |
+
template<class Duration>
|
| 126 |
+
auto operator()(const time_point<SourceClock, Duration>& t) const
|
| 127 |
+
-> decltype(SourceClock::to_sys(t));
|
| 128 |
+
};
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
``` cpp
|
| 132 |
+
template<class Duration>
|
| 133 |
+
auto operator()(const time_point<SourceClock, Duration>& t) const
|
| 134 |
+
-> decltype(SourceClock::to_sys(t));
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
*Constraints:* `SourceClock::to_sys(t)` is well-formed.
|
| 138 |
+
|
| 139 |
+
*Mandates:* `SourceClock::to_sys(t)` returns a `sys_time<Duration>`,
|
| 140 |
+
where `Duration` is a valid `chrono::duration` specialization.
|
| 141 |
+
|
| 142 |
+
*Returns:* `SourceClock::to_sys(t)`.
|
| 143 |
+
|
| 144 |
+
``` cpp
|
| 145 |
+
template<class DestClock>
|
| 146 |
+
struct clock_time_conversion<DestClock, system_clock> {
|
| 147 |
+
template<class Duration>
|
| 148 |
+
auto operator()(const sys_time<Duration>& t) const
|
| 149 |
+
-> decltype(DestClock::from_sys(t));
|
| 150 |
+
};
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
``` cpp
|
| 154 |
+
template<class Duration>
|
| 155 |
+
auto operator()(const sys_time<Duration>& t) const
|
| 156 |
+
-> decltype(DestClock::from_sys(t));
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
*Constraints:* `DestClock::from_sys(t)` is well-formed.
|
| 160 |
+
|
| 161 |
+
*Mandates:* `DestClock::from_sys(t)` returns a
|
| 162 |
+
`time_point<DestClock, Duration>`, where `Duration` is a valid
|
| 163 |
+
`chrono::duration` specialization.
|
| 164 |
+
|
| 165 |
+
*Returns:* `DestClock::from_sys(t)`.
|
| 166 |
+
|
| 167 |
+
#### Conversions between `utc_clock` and other clocks <a id="time.clock.cast.utc">[[time.clock.cast.utc]]</a>
|
| 168 |
+
|
| 169 |
+
``` cpp
|
| 170 |
+
template<class SourceClock>
|
| 171 |
+
struct clock_time_conversion<utc_clock, SourceClock> {
|
| 172 |
+
template<class Duration>
|
| 173 |
+
auto operator()(const time_point<SourceClock, Duration>& t) const
|
| 174 |
+
-> decltype(SourceClock::to_utc(t));
|
| 175 |
+
};
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
``` cpp
|
| 179 |
+
template<class Duration>
|
| 180 |
+
auto operator()(const time_point<SourceClock, Duration>& t) const
|
| 181 |
+
-> decltype(SourceClock::to_utc(t));
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
*Constraints:* `SourceClock::to_utc(t)` is well-formed.
|
| 185 |
+
|
| 186 |
+
*Mandates:* `SourceClock::to_utc(t)` returns a `utc_time<Duration>`,
|
| 187 |
+
where `Duration` is a valid `chrono::duration` specialization.
|
| 188 |
+
|
| 189 |
+
*Returns:* `SourceClock::to_utc(t)`.
|
| 190 |
+
|
| 191 |
+
``` cpp
|
| 192 |
+
template<class DestClock>
|
| 193 |
+
struct clock_time_conversion<DestClock, utc_clock> {
|
| 194 |
+
template<class Duration>
|
| 195 |
+
auto operator()(const utc_time<Duration>& t) const
|
| 196 |
+
-> decltype(DestClock::from_utc(t));
|
| 197 |
+
};
|
| 198 |
+
```
|
| 199 |
+
|
| 200 |
+
``` cpp
|
| 201 |
+
template<class Duration>
|
| 202 |
+
auto operator()(const utc_time<Duration>& t) const
|
| 203 |
+
-> decltype(DestClock::from_utc(t));
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
*Constraints:* `DestClock::from_utc(t)` is well-formed.
|
| 207 |
+
|
| 208 |
+
*Mandates:* `DestClock::from_utc(t)` returns a
|
| 209 |
+
`time_point<DestClock, Duration>`, where `Duration` is a valid
|
| 210 |
+
`chrono::duration` specialization.
|
| 211 |
+
|
| 212 |
+
*Returns:* `DestClock::from_utc(t)`.
|
| 213 |
+
|
| 214 |
+
#### Function template `clock_cast` <a id="time.clock.cast.fn">[[time.clock.cast.fn]]</a>
|
| 215 |
+
|
| 216 |
+
``` cpp
|
| 217 |
+
template<class DestClock, class SourceClock, class Duration>
|
| 218 |
+
auto clock_cast(const time_point<SourceClock, Duration>& t);
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
*Constraints:* At least one of the following clock time conversion
|
| 222 |
+
expressions is well-formed:
|
| 223 |
+
|
| 224 |
+
- ``` cpp
|
| 225 |
+
clock_time_conversion<DestClock, SourceClock>{}(t)
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
- ``` cpp
|
| 229 |
+
clock_time_conversion<DestClock, system_clock>{}(
|
| 230 |
+
clock_time_conversion<system_clock, SourceClock>{}(t))
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
- ``` cpp
|
| 234 |
+
clock_time_conversion<DestClock, utc_clock>{}(
|
| 235 |
+
clock_time_conversion<utc_clock, SourceClock>{}(t))
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
- ``` cpp
|
| 239 |
+
clock_time_conversion<DestClock, utc_clock>{}(
|
| 240 |
+
clock_time_conversion<utc_clock, system_clock>{}(
|
| 241 |
+
clock_time_conversion<system_clock, SourceClock>{}(t)))
|
| 242 |
+
```
|
| 243 |
+
|
| 244 |
+
- ``` cpp
|
| 245 |
+
clock_time_conversion<DestClock, system_clock>{}(
|
| 246 |
+
clock_time_conversion<system_clock, utc_clock>{}(
|
| 247 |
+
clock_time_conversion<utc_clock, SourceClock>{}(t)))
|
| 248 |
+
```
|
| 249 |
+
|
| 250 |
+
A clock time conversion expression is considered better than another
|
| 251 |
+
clock time conversion expression if it involves fewer `operator()` calls
|
| 252 |
+
on `clock_time_conversion` specializations.
|
| 253 |
+
|
| 254 |
+
*Mandates:* Among the well-formed clock time conversion expressions from
|
| 255 |
+
the above list, there is a unique best expression.
|
| 256 |
+
|
| 257 |
+
*Returns:* The best well-formed clock time conversion expression in the
|
| 258 |
+
above list.
|
| 259 |
+
|