SaturnRingLibrary 0.9.2
SGL wrapper
Loading...
Searching...
No Matches

◆ FromSeconds()

template<float Seconds>
const Tickstamp & SRL::Tickstamp::FromSeconds ( )
inlinestatic

Create Tickstamp from seconds at compile time (dual-frequency).

Template Parameters
SecondsTime value in seconds as float template parameter
Returns
const reference to the appropriate Tickstamp for current frequency

Calculates two complete Tickstamps at compile time (26MHz and 28MHz), stores them in static constexpr variables, then returns a reference to the correct one at runtime.

Example:
const auto& oneSecond = Tickstamp::FromSeconds<1.0f>(); // Runtime selection
Fxp secs = oneSecond.ToSeconds(); // Already correct for current frequency
static const Tickstamp & FromSeconds()
Create Tickstamp from seconds at compile time (dual-frequency).
Definition srl_timer.hpp:297