diff --git a/stepmania/src/RageTimer.cpp b/stepmania/src/RageTimer.cpp index e3719f47f9..5347cef9a8 100644 --- a/stepmania/src/RageTimer.cpp +++ b/stepmania/src/RageTimer.cpp @@ -105,6 +105,13 @@ float RageTimer::operator-(const RageTimer &rhs) const return Difference(*this, rhs); } +bool RageTimer::operator<( const RageTimer &rhs ) const +{ + if( m_secs != rhs.m_secs ) return m_secs < rhs.m_secs; + return m_us < rhs.m_us; + +} + RageTimer RageTimer::Sum(const RageTimer &lhs, float tm) { /* tm == 5.25 -> secs = 5, us = 5.25 - ( 5) = .25 diff --git a/stepmania/src/RageTimer.h b/stepmania/src/RageTimer.h index 81b7ed25ee..3bedd02a9c 100644 --- a/stepmania/src/RageTimer.h +++ b/stepmania/src/RageTimer.h @@ -29,11 +29,15 @@ public: /* Add (or subtract) a duration from a timestamp. The result is another timestamp. */ RageTimer operator+( float tm ) const; + RageTimer operator-( float tm ) const { return *this + -tm; } void operator+=( float tm ) { *this = *this + tm; } + void operator-=( float tm ) { *this = *this + -tm; } /* Find the amount of time between two timestamps. The result is a duration. */ float operator-( const RageTimer &rhs ) const; + bool operator<( const RageTimer &rhs ) const; + /* "float" is bad for a "time since start" RageTimer. If the game is running for * several days, we'll lose a lot of resolution. I don't want to use double * everywhere, since it's slow. I'd rather not use double just for RageTimers, since