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

◆ ToMilliseconds()

Math::Types::Fxp SRL::Tickstamp::ToMilliseconds ( ) const
inlinenoexcept

Converts ticks to milliseconds using DVU hardware acceleration.

Returns
Time in milliseconds as fixed-point number (Fxp 16.16 format).

Uses SH-2 DVU for 64-bit division: (ticks << 16) / (frequency / 1000). Provides millisecond resolution but with reduced maximum range.

Range:
  • Minimum: ~0.00447 milliseconds (1 tick at PHI_128)
  • Maximum: 32767 milliseconds (~32.8 seconds)
  • Overflow: Values above 32767 will wrap in Fxp 16.16 format
When to Use:
Use this method when you need millisecond precision for short durations (e.g., animation timing, input delays, frame timing). For longer durations (>30 seconds), use ToSeconds() instead to avoid overflow.
Warning
CRITICAL: The 32767 ms limit (~32.8 seconds) is much smaller than ToSeconds(). If you need to measure durations longer than 30 seconds, always use ToSeconds().
Example:
Tickstamp elapsed = Timer::DeltaTicks();
Fxp ms = elapsed.ToMilliseconds();
if (ms > 16.0) { // More than 16ms (>60fps)
// Handle slow frame
}
Math::Types::Fxp ToMilliseconds() const noexcept
Converts ticks to milliseconds using DVU hardware acceleration.
Definition srl_timer.hpp:498
static const Tickstamp & DeltaTicks() noexcept
Frame delta ticks (raw elapsed ticks between frames).
Definition srl_timer.hpp:930
See also
ToSeconds() for longer range (up to 9.1 hours)