Duration
- Implemented missing operator<=, operator>=. - Added corresponding unit tests.
This commit is contained in:
@@ -226,6 +226,15 @@ bool Duration::operator< (const Duration& other)
|
||||
return left < right;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Duration::operator<= (const Duration& other)
|
||||
{
|
||||
long left = (long) ( mNegative ? -mSecs : mSecs);
|
||||
long right = (long) (other.mNegative ? -other.mSecs : other.mSecs);
|
||||
|
||||
return left <= right;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Duration::operator> (const Duration& other)
|
||||
{
|
||||
@@ -235,6 +244,15 @@ bool Duration::operator> (const Duration& other)
|
||||
return left > right;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Duration::operator>= (const Duration& other)
|
||||
{
|
||||
long left = (long) ( mNegative ? -mSecs : mSecs);
|
||||
long right = (long) (other.mNegative ? -other.mSecs : other.mSecs);
|
||||
|
||||
return left >= right;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Duration::~Duration ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user