Add -=, - and * (with integer) operators to TimeUnit

This commit is contained in:
trav90
2017-05-04 02:19:45 -05:00
committed by roytam1
parent c090489735
commit dd1669990b
+15
View File
@@ -173,6 +173,21 @@ public:
MOZ_ASSERT(!IsInfinite() && !aOther.IsInfinite());
return TimeUnit(mValue - aOther.mValue);
}
TimeUnit& operator += (const TimeUnit& aOther) {
*this = *this + aOther;
return *this;
}
TimeUnit& operator -= (const TimeUnit& aOther) {
*this = *this - aOther;
return *this;
}
friend TimeUnit operator* (int aVal, const TimeUnit& aUnit) {
return TimeUnit(aUnit.mValue * aVal);
}
friend TimeUnit operator* (const TimeUnit& aUnit, int aVal) {
return TimeUnit(aUnit.mValue * aVal);
}
bool IsValid() const
{