FreeBSD Manual Pages
std::chrono..._conversion(3) C++ Standard Libary std::chrono..._conversion(3) NAME std::chrono::clock_time_conversion - std::chrono::clock_time_conversion Synopsis Defined in header <chrono> template<class Dest, class Source> struct clock_time_conversion { }; (since C++20) 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 an 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_conver- sion 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: template<class Clock> struct clock_time_conversion<Clock, Clock>; (1) (since C++20) template<> struct clock_time_conversion<std::chrono::system_clock, (2) (since C++20) std::chrono::system_clock>; template<> struct clock_time_conversion<std::chrono::utc_clock, (3) (since C++20) std::chrono::utc_clock>; template<> struct clock_time_conversion<std::chrono::system_clock, (4) (since C++20) std::chrono::utc_clock>; template<> struct clock_time_conversion<std::chrono::utc_clock, (5) (since C++20) std::chrono::system_clock>; template<class Clock> struct clock_time_conversion<Clock, (6) (since C++20) std::chrono::system_clock>; template<class Clock> struct (7) (since C++20) clock_time_conversion<std::chrono::system_clock, Clock>; template<class Clock> struct clock_time_conversion<Clock, (8) (since C++20) std::chrono::utc_clock>; template<class Clock> struct (9) (since C++20) clock_time_conversion<std::chrono::utc_clock, Clock>; 1-3) Identity conversion: operator() returns a copy of the argument. 4-5) Conversions between std::chrono::sys_time and std::chrono::utc_time: operator() calls std::chrono::utc_clock::to_sys and std::chrono::utc_clock::from_sys, respectively. 6-7) Conversions to and from std::chrono::sys_time when Clock sup- ports from_sys and to_sys: operator() calls Clock::to_sys and Clock::from_sys, respec- tively. 8-9) Conversions to and from std::chrono::utc_time when Clock sup- ports from_utc and to_utc: operator() calls Clock::to_utc and Clock::from_utc, respec- tively. Member functions Each specialization has an implicitly-declared default constructor, copy constructor, move constructor, copy assignment operator, move as- signment operator, and destructor. std::chrono::clock_time_conversion::operator() template <class Duration> std::chrono::time_point<Clock, Duration> (1) (member of spe- cialization (1)) operator()(const std::chrono::time_point<Clock, Duration>& t) const; template <class Duration> std::chrono::sys_time<Duration> (2) (member of spe- cialization (2)) operator()(const std::chrono::sys_time<Duration> & t) const; template <class Duration> (mem- ber of std::chrono::utc_time<Duration> (3) spe- cialization (3)) operator()(const std::chrono::utc_time<Duration>& t) const; template <class Duration> (mem- ber of std::chrono::sys_time<Duration> (4) spe- cialization (4)) operator()(const std::chrono::utc_time<Duration>& t) const; template <class Duration> (mem- ber of std::chrono::utc_time<Duration> (5) spe- cialization (5)) operator()(const std::chrono::sys_time<Duration>& t) const; template <class Duration> auto operator()(const std::chrono::sys_time<Duration>& t) (6) (member of const spe- cialization (6)) -> decltype(Clock::from_sys(t)); template <class Duration> auto operator()(const std::chrono::time_point<SourceClock, (7) (member of Duration>& t) const spe- cialization (7)) -> decltype(Clock::to_sys(t)); template <class Duration> auto operator()(const std::chrono::utc_time<Duration>& t) (8) (member of const spe- cialization (8)) -> decltype(Clock::from_utc(t)); template <class Duration> auto operator()(const std::chrono::time_point<Clock, (9) (member of Duration>& t) const spe- cialization (9)) -> decltype(Clock::to_utc(t)); Converts the argument std::chrono::time_point to the destination clock. 1-3) Identity conversion. Returns t unchanged. 4) Returns std::chrono::utc_clock::to_sys(t). 5) Returns std::chrono::utc_clock::from_sys(t). 6) Returns Clock::from_sys(t). This overload participates in over- load resolution only if the expression Clock::from_sys(t) is well-formed. The pro- gram is ill-formed if Clock::from_sys(t) does not return std::chrono::time_point<Clock, Duration> where Duration is some valid specialization of std::chrono::duration. 7) Returns Clock::to_sys(t). This overload participates in overload resolution only if the expression Clock::to_sys(t) is well-formed. The program is ill-formed if Clock::to_sys(t) does not return std::chrono::sys_time<Duration> where Duration is some valid specialization of std::chrono::duration. 8) Returns Clock::from_utc(t). This overload participates in over- load resolution only if the expression Clock::from_utc(t) is well-formed. The pro- gram is ill-formed if Clock::from_utc(t) does not return std::chrono::time_point<Clock, Duration> where Duration is some valid specialization of std::chrono::duration. 9) Returns Clock::to_utc(t). This overload participates in overload resolution only if the expression Clock::to_utc(t) is well-formed. The program is ill-formed if Clock::to_utc(t) does not return std::chrono::utc_time<Duration> where Duration is some valid specialization of std::chrono::duration. Parameters t - time point to convert Return value The result of the conversion as described above: 1-3) t. 4) std::chrono::utc_clock::to_sys(t). 5) std::chrono::utc_clock::from_sys(t). 6) Clock::from_sys(t). 7) Clock::to_sys(t). 8) Clock::from_utc(t). 9) Clock::to_utc(t). See also clock_cast convert time points of one clock to another (C++20) (function template) http://cppreference.com 2022.07.31 std::chrono..._conversion(3)
NAME | Synopsis | Member functions | Parameters | Return value | See also
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::chrono::clock_time_conversion&sektion=3&manpath=FreeBSD+Ports+15.0>
