cpp/chrono/clock time conversion

is a trait that specifies how to convert a std of the clock to that of the  clock. It does so by providing a const-callable that accepts an argument of type  and returns a  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. is normally only used indirectly, via std.

A program may specialize 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:

@1-3@ Identity conversion: returns a copy of the argument. @4-5@ Conversions between std and std: calls std and std, respectively. @6-7@ Conversions to and from std when supports  and :  calls  and, respectively. @8-9@ Conversions to and from std when supports  and :  calls  and, respectively.

Member functions
Each specialization has an implicitly-declared default constructor, copy constructor, move constructor, copy assignment operator, move assignment operator, and destructor.

{{member|{{small|std::chrono::clock_time_conversion::}}operator|2= {{dcl begin}} {{dcl|num=1|notes={{mark|member of specialization {{v|1}}}}|1= template< class Duration > std::chrono::time_point operator( const std::chrono::time_point& t ) const; }} {{dcl|num=2|notes={{mark|member of specialization {{v|2}}}}|1= template< class Duration > std::chrono::sys_time operator( const std::chrono::sys_time & t ) const; }} {{dcl|num=3|notes={{mark|member of specialization {{v|3}}}}|1= template< class Duration > std::chrono::utc_time operator( const std::chrono::utc_time& t ) const; }} {{dcl|num=4|notes={{mark|member of specialization {{v|4}}}}|1= template< class Duration > std::chrono::sys_time operator( const std::chrono::utc_time& t ) const; }} {{dcl|num=5|notes={{mark|member of specialization {{v|5}}}}|1= template< class Duration > std::chrono::utc_time operator( const std::chrono::sys_time& t ) const; }} {{dcl|num=6|notes={{mark|member of specialization {{v|6}}}}|1= template< class Duration > auto operator( const std::chrono::sys_time& t ) const -> decltype(Clock::from_sys(t)); }} {{dcl|num=7|notes={{mark|member of specialization {{v|7}}}}|1= template< class Duration > auto operator( const std::chrono::time_point& t ) const -> decltype(Clock::to_sys(t)); }} {{dcl|num=8|notes={{mark|member of specialization {{v|8}}}}|1= template< class Duration > auto operator( const std::chrono::utc_time& t ) const -> decltype(Clock::from_utc(t)); }} {{dcl|num=9|notes={{mark|member of specialization {{v|9}}}}|1= template< class Duration > auto operator( const std::chrono::time_point& t ) const -> decltype(Clock::to_utc(t)); }} {{dcl end}}

Converts the argument {{lc|std::chrono::time_point}} to the destination clock.

@1-3@ Identity conversion. Returns {{tt|t}} unchanged. @4@ Returns {{c|std::chrono::utc_clock::to_sys(t)}}. @5@ Returns {{c|std::chrono::utc_clock::from_sys(t)}}. @6@ Returns {{c|Clock::from_sys(t)}}. {{cpp/enable_if|the expression {{c|Clock::from_sys(t)}} is well-formed}}. The program is ill-formed if {{c|Clock::from_sys(t)}} does not return {{c|std::chrono::time_point}} where {{tt|Duration}} is some valid specialization of {{lc|std::chrono::duration}}. @7@ Returns {{c|Clock::to_sys(t)}}. {{cpp/enable_if|the expression {{c|Clock::to_sys(t)}} is well-formed}}. The program is ill-formed if {{c|Clock::to_sys(t)}} does not return {{c|std::chrono::sys_time}} where {{tt|Duration}} is some valid specialization of {{lc|std::chrono::duration}}. @8@ Returns {{c|Clock::from_utc(t)}}. {{cpp/enable_if|the expression {{c|Clock::from_utc(t)}} is well-formed}}. The program is ill-formed if {{c|Clock::from_utc(t)}} does not return {{c|std::chrono::time_point<Clock, Duration>}} where {{tt|Duration}} is some valid specialization of {{lc|std::chrono::duration}}. @9@ Returns {{c|Clock::to_utc(t)}}. {{cpp/enable_if|the expression {{c|Clock::to_utc(t)}} is well-formed}}. The program is ill-formed if {{c|Clock::to_utc(t)}} does not return {{c|std::chrono::utc_time<Duration>}} where {{tt|Duration}} is some valid specialization of {{lc|std::chrono::duration}}.

Return value
The result of the conversion as described above: @1-3@ . @4@ . @5@ . @6@ . @7@ . @8@ . @9@.

}}