27 Time library [time]

27.7 Clocks [time.clock]

27.7.9 time_­point conversions [time.clock.cast] Function template clock_­cast [time.clock.cast.fn]

template<class DestClock, class SourceClock, class Duration> auto clock_cast(const time_point<SourceClock, Duration>& t);
Remarks: This function does not participate in overload resolution unless at least one of the following clock time conversion expressions is well-formed:
  • clock_time_conversion<DestClock, SourceClock>{}(t)
  • clock_time_conversion<DestClock, system_clock>{}(
        clock_time_conversion<system_clock, SourceClock>{}(t))
  • clock_time_conversion<DestClock, utc_clock>{}(
        clock_time_conversion<utc_clock, SourceClock>{}(t))
  • clock_time_conversion<DestClock, utc_clock>{}(
        clock_time_conversion<utc_clock, system_clock>{}(
            clock_time_conversion<system_clock, SourceClock>{}(t)))
  • clock_time_conversion<DestClock, system_clock>{}(
        clock_time_conversion<system_clock, utc_clock>{}(
            clock_time_conversion<utc_clock, SourceClock>{}(t)))
A clock time conversion expression is considered better than another clock time conversion expression if it involves fewer operator() calls on clock_­time_­conversion specializations.
If, among the well-formed clock time conversion expressions from the above list, there is not a unique best expression, the clock_­cast is ambiguous and the program is ill-formed.
Returns: The best well-formed clock time conversion expression in the above list.