std::chrono::clock_cast
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Date and time library
(C++11)
(C++20)
clock_cast
(C++20)
(C++11)
(C++11)
(C++11)
(C++20)
(C++20)
(C++20)
(C++11)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
Defined in header
<chrono>
template< class Dest, class Source, class Duration >
auto clock_cast( const std::chrono::time_point <Source, Duration>& t );
(since C++20)
auto clock_cast( const std::chrono::time_point <Source, Duration>& t );
Converts the time point t
of a clock Source
to an equivalent time point of the clock Dest
, using std::chrono::system_clock and/or std::chrono::utc_clock as intermediaries if necessary.
- If the expression std::chrono::clock_time_conversion <Dest, Source>{}(t) is well-formed, returns the result of that expression.
- Otherwise, if at least one of the following two expressions are well-formed, then
- If both expressions are well-formed, the conversion is ambiguous, and the program is ill-formed.
- Otherwise, exactly one of the two expressions is well-formed; the result of that expression is returned.
1) std::chrono::clock_time_conversion <Dest, std::chrono::system_clock >{}(
std::chrono::clock_time_conversion <std::chrono::system_clock, Source>{}(t))
std::chrono::clock_time_conversion <std::chrono::system_clock, Source>{}(t))
2) std::chrono::clock_time_conversion <Dest, std::chrono::utc_clock >{}(
std::chrono::clock_time_conversion <std::chrono::utc_clock, Source>{}(t))
std::chrono::clock_time_conversion <std::chrono::utc_clock, Source>{}(t))
- Otherwise, if at least one of the following two expressions are well-formed, then
- If both expressions are well-formed, the conversion is ambiguous, and the program is ill-formed.
- Otherwise, exactly one of the two expressions is well-formed; the result of that expression is returned.
1) std::chrono::clock_time_conversion <Dest, std::chrono::utc_clock >{}(
std::chrono::clock_time_conversion <std::chrono::utc_clock, std::chrono::system_clock >{}(
2) std::chrono::clock_time_conversion <Dest, std::chrono::system_clock >{}(
std::chrono::clock_time_conversion <std::chrono::system_clock, std::chrono::utc_clock >{}(
- Otherwise, this function does not participate in overload resolution.
[edit] Return value
The result of the conversion, determined as described above.
[edit] Example
This section is incomplete
Reason: no example
Reason: no example
[edit] See also
(C++20)
(class template) [edit]