33 lines
2.0 KiB
Markdown
33 lines
2.0 KiB
Markdown
[time.clock.conv]
|
||
|
||
# 30 Time library [[time]](./#time)
|
||
|
||
## 30.7 Clocks [[time.clock]](time.clock#conv)
|
||
|
||
### 30.7.10 time_point conversions [[time.clock.cast]](time.clock.cast#time.clock.conv)
|
||
|
||
#### 30.7.10.1 Class template clock_time_conversion [time.clock.conv]
|
||
|
||
namespace std::chrono {template<class DestClock, class SourceClock>struct clock_time_conversion {};}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3583)
|
||
|
||
clock_time_conversion serves as a trait
|
||
which can be used to specify how to convert
|
||
a source time_point of typetime_point<SourceClock, Duration> to a destination time_point of typetime_point<DestClock, Duration> via a specialization:clock_time_conversion<DestClock, SourceClock>[.](#1.sentence-1)
|
||
|
||
A specialization of clock_time_conversion<DestClock, SourceClock> shall provide a const-qualified operator() that takes a parameter of type time_point<SourceClock, Duration> and returns a time_point<DestClock, OtherDuration> representing an equivalent point in time[.](#1.sentence-2)
|
||
|
||
OtherDuration is a chrono::duration whose specialization is computed from the input Duration in a manner which can vary for each clock_time_conversion specialization[.](#1.sentence-3)
|
||
|
||
A program may specialize clock_time_conversion if at least one of the template parameters is a user-defined clock type[.](#1.sentence-4)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3603)
|
||
|
||
Several specializations are provided by the implementation,
|
||
as described in[[time.clock.cast.id]](time.clock.cast.id "30.7.10.2 Identity conversions"),[[time.clock.cast.sys.utc]](time.clock.cast.sys.utc "30.7.10.3 Conversions between system_clock and utc_clock"),[[time.clock.cast.sys]](time.clock.cast.sys "30.7.10.4 Conversions between system_clock and other clocks"), and[[time.clock.cast.utc]](time.clock.cast.utc "30.7.10.5 Conversions between utc_clock and other clocks")[.](#2.sentence-1)
|