Files
2025-10-25 03:02:53 +03:00

33 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.2Identity conversions"),[[time.clock.cast.sys.utc]](time.clock.cast.sys.utc "30.7.10.3Conversions between system_­clock and utc_­clock"),[[time.clock.cast.sys]](time.clock.cast.sys "30.7.10.4Conversions between system_­clock and other clocks"), and[[time.clock.cast.utc]](time.clock.cast.utc "30.7.10.5Conversions between utc_­clock and other clocks")[.](#2.sentence-1)