mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-21 01:24:21 +00:00
Refactored some operators in Time and RelativeTime, and made the Time constructor explicit.
This commit is contained in:
parent
968d63bca6
commit
ece4205d3d
24 changed files with 421 additions and 540 deletions
|
|
@ -496,4 +496,21 @@ const String Time::getWeekdayName (int day, const bool threeLetterVersion)
|
|||
: longDayNames [day]);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Time& Time::operator+= (const RelativeTime& delta) { millisSinceEpoch += delta.inMilliseconds(); return *this; }
|
||||
Time& Time::operator-= (const RelativeTime& delta) { millisSinceEpoch -= delta.inMilliseconds(); return *this; }
|
||||
|
||||
const Time operator+ (const Time& time, const RelativeTime& delta) { Time t (time); return t += delta; }
|
||||
const Time operator- (const Time& time, const RelativeTime& delta) { Time t (time); return t -= delta; }
|
||||
const Time operator+ (const RelativeTime& delta, const Time& time) { Time t (time); return t += delta; }
|
||||
const RelativeTime operator- (const Time& time1, const Time& time2) { return RelativeTime::milliseconds (time1.toMilliseconds() - time2.toMilliseconds()); }
|
||||
|
||||
bool operator== (const Time& time1, const Time& time2) { return time1.toMilliseconds() == time2.toMilliseconds(); }
|
||||
bool operator!= (const Time& time1, const Time& time2) { return time1.toMilliseconds() != time2.toMilliseconds(); }
|
||||
bool operator< (const Time& time1, const Time& time2) { return time1.toMilliseconds() < time2.toMilliseconds(); }
|
||||
bool operator> (const Time& time1, const Time& time2) { return time1.toMilliseconds() > time2.toMilliseconds(); }
|
||||
bool operator<= (const Time& time1, const Time& time2) { return time1.toMilliseconds() <= time2.toMilliseconds(); }
|
||||
bool operator>= (const Time& time1, const Time& time2) { return time1.toMilliseconds() >= time2.toMilliseconds(); }
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue