FastLED 3.9.15
Loading...
Searching...
No Matches

◆ duration_cast_impl()

template<typename Rep, typename Period = fl::ratio<1>>
template<typename ToRep, typename ToPeriod, typename FromRep, typename FromPeriod>
static constexpr ToRep fl::chrono::duration< Rep, Period >::duration_cast_impl ( FromRep count)
inlinestaticconstexprprivate

Internal duration_cast implementation.

Definition at line 64 of file chrono.h.

64 {
65 // Convert from source period to destination period
66 // target_count = source_count * (FromPeriod / ToPeriod)
67 // Using: target = source * FromPeriod::num * ToPeriod::den / (FromPeriod::den * ToPeriod::num)
69 return static_cast<ToRep>(
70 static_cast<FromRep>(count) * static_cast<FromRep>(ratio::num) / static_cast<FromRep>(ratio::den)
71 );
72 }
constexpr Rep count() const FL_NOEXCEPT
Get the tick count.
Definition chrono.h:57
Represents a time duration.
Definition chrono.h:36