FastLED 3.10.8
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 67 of file chrono.h.

67 {
68 // Convert from source period to destination period
69 // target_count = source_count * (FromPeriod / ToPeriod)
70 // Using: target = source * FromPeriod::num * ToPeriod::den / (FromPeriod::den * ToPeriod::num)
72 return static_cast<ToRep>(
73 static_cast<FromRep>(count) * static_cast<FromRep>(ratio::num) / static_cast<FromRep>(ratio::den)
74 );
75 }
constexpr Rep count() const FL_NO_EXCEPT
Get the tick count.
Definition chrono.h:60
Represents a time duration.
Definition chrono.h:39