High-precision 48-bit timestamp with DVU hardware acceleration.
Stores timer values as a 48-bit composite (32-bit overflow counter + 16-bit FRT). The internal representation uses 64-bit storage (high=Timer32, low=FRT<<16) to enable hardware-accelerated division via the SH-2 DVU.
Example: 1 second at 26.6875 MHz
#include <srl_timer.hpp>
Classes | |
| struct | ClockTime |
| Immutable clock display format (HH:MM:SS.mmm). More... | |
Public Member Functions | |
| Tickstamp ()=default | |
| Default constructor. Initializes to zero. | |
Core Operations | |
Essential timer operations for time calculations. | |
| Tickstamp | operator- (const Tickstamp &other) const noexcept |
| 64-bit subtraction with borrow (hardware-accelerated). | |
| Tickstamp | operator+ (const Tickstamp &other) const noexcept |
| 64-bit addition with carry (hardware-accelerated). | |
| bool | operator== (const Tickstamp &other) const noexcept |
| Equality comparison. | |
| bool | operator!= (const Tickstamp &other) const noexcept |
| Inequality comparison. | |
| bool | operator< (const Tickstamp &other) const noexcept |
| Less-than comparison. | |
| bool | operator> (const Tickstamp &other) const noexcept |
| Greater-than comparison. | |
| bool | operator<= (const Tickstamp &other) const noexcept |
| Less-than-or-equal comparison. | |
| bool | operator>= (const Tickstamp &other) const noexcept |
| Greater-than-or-equal comparison. | |
| Math::Types::Fxp | ToMilliseconds () const noexcept |
| Converts ticks to milliseconds using DVU hardware acceleration. | |
| Math::Types::Fxp | ToSeconds () const noexcept |
| Converts ticks to seconds using DVU hardware acceleration. | |
| Math::Types::Fxp | ToMinutes () const noexcept |
| Converts ticks to minutes using DVU hardware acceleration. | |
| ClockTime | ToClock () const noexcept |
| Converts ticks to clock display format (HH:MM:SS.mmm) using 1 DVU division. | |
Static Public Member Functions | |
Compile-Time Builders | |
Create Tickstamps at compile time with no runtime conversion overhead. These builders calculate both 26MHz and 28MHz tick counts at compile time, storing two complete Tickstamps, then return a reference to the appropriate one at runtime based on the active divider. | |
| static constexpr Tickstamp | FromTicks (uint64_t ticks) |
| Create Tickstamp from raw tick count at compile time. | |
| template<float Seconds> | |
| static const Tickstamp & | FromSeconds () |
| Create Tickstamp from seconds at compile time (dual-frequency). | |
| template<float Milliseconds> | |
| static const Tickstamp & | FromMilliseconds () |
| Create Tickstamp from milliseconds at compile time (dual-frequency). | |
| template<float Minutes> | |
| static const Tickstamp & | FromMinutes () |
| Create Tickstamp from minutes at compile time (dual-frequency). | |
Public Attributes | |
| uint32_t | High |
| High 32 bits of the 48-bit timestamp. | |
| uint32_t | Low |
| Low 32 bits formatted for DVU division. | |