std::chrono::clock_time_conversion
<chrono>
struct clock_time_conversion {};
std::chrono::clock_time_conversion
is a trait that specifies how to convert a std::chrono::time_point of the Source
clock to that of the Dest
clock. It does so by providing a const-callable operator()
that accepts an argument of type std::chrono::time_point <Source, Duration> and returns a std::chrono::time_point <Dest, OtherDuration> that represents an equivalent point in time. The duration of the returned time point is computed from the source duration in a manner that varies for each specialization. clock_time_conversion
is normally only used indirectly, via std::chrono::clock_cast.
A program may specialize clock_time_conversion
if at least one of the template parameters is a user-defined clock type.
The primary template is an empty struct. The standard defines the following specializations:
struct clock_time_conversion<Clock, Clock>;
struct clock_time_conversion<std::chrono::system_clock, std::chrono::system_clock >;
struct clock_time_conversion<std::chrono::utc_clock, std::chrono::utc_clock >;
struct clock_time_conversion<std::chrono::system_clock, std::chrono::utc_clock >;
struct clock_time_conversion<std::chrono::utc_clock, std::chrono::system_clock >;
struct clock_time_conversion<Clock, std::chrono::system_clock >;
struct clock_time_conversion<std::chrono::system_clock, Clock>;
struct clock_time_conversion<Clock, std::chrono::utc_clock >;
struct clock_time_conversion<std::chrono::utc_clock, Clock>;
operator()
returns a copy of the argument.operator()
calls std::chrono::utc_clock::to_sys and std::chrono::utc_clock::from_sys, respectively.Clock
supports from_sys
and to_sys
: operator()
calls Clock::to_sys and Clock::from_sys, respectively.Clock
supports from_utc
and to_utc
: operator()
calls Clock::to_utc and Clock::from_utc, respectively.Contents
[edit] Member functions
Each specialization has an implicitly-declared default constructor, copy constructor, move constructor, copy assignment operator, move assignment operator, and destructor.
std::chrono::clock_time_conversion::operator()
std::chrono::time_point <Clock, Duration>
std::chrono::sys_time <Duration>
std::chrono::utc_time <Duration>
std::chrono::sys_time <Duration>
std::chrono::utc_time <Duration>
auto operator()( const std::chrono::sys_time <Duration>& t ) const
auto operator()( const std::chrono::time_point <SourceClock, Duration>& t ) const
auto operator()( const std::chrono::utc_time <Duration>& t ) const
auto operator()( const std::chrono::time_point <Clock, Duration>& t ) const
Converts the argument std::chrono::time_point to the destination clock.
t
unchanged.Duration
is some valid specialization of std::chrono::duration .Duration
is some valid specialization of std::chrono::duration .Duration
is some valid specialization of std::chrono::duration .Duration
is some valid specialization of std::chrono::duration .Parameters
Return value
The result of the conversion as described above: