Bug 1203350 - Unify arithmetic operators in TimeStamp; r=froydnj
authorBrian Birtles <birtles@gmail.com>
Fri, 11 Sep 2015 15:02:04 +0900
changeset 296213 b2d47f9818cea6d798c92ff0883fba88d06cd744
parent 296212 991e80fcdd03ef4472c8cc0f2bee70fe39f8374a
child 296214 44fbcc7586216758468e8d9252598ef31aba8ddf
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1203350
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1203350 - Unify arithmetic operators in TimeStamp; r=froydnj
mozglue/misc/TimeStamp.h
--- a/mozglue/misc/TimeStamp.h
+++ b/mozglue/misc/TimeStamp.h
@@ -486,23 +486,25 @@ public:
         ticks = INT64_MIN;
       }
     }
     return TimeDuration::FromTicks(ticks);
   }
 
   TimeStamp operator+(const TimeDuration& aOther) const
   {
-    MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
-    return TimeStamp(mValue + aOther.mValue);
+    TimeStamp result = *this;
+    result += aOther;
+    return result;
   }
   TimeStamp operator-(const TimeDuration& aOther) const
   {
-    MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
-    return TimeStamp(mValue - aOther.mValue);
+    TimeStamp result = *this;
+    result -= aOther;
+    return result;
   }
   TimeStamp& operator+=(const TimeDuration& aOther)
   {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     mValue += aOther.mValue;
     return *this;
   }
   TimeStamp& operator-=(const TimeDuration& aOther)