Bug 839911 - Add a convenient forever() time period constructor; r=roc
authorAnthony Jones <ajones@mozilla.com>
Fri, 06 Dec 2013 16:21:39 +1300
changeset 173798 edc4afb4bc487a782e1e252b9171d8364480e54f
parent 173797 ac41fb323652670d13c1f998e5c35d2943538540
child 173799 a6008184956d376254fb49fc8f4f227b4f51eb41
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs839911
milestone28.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 839911 - Add a convenient forever() time period constructor; r=roc
xpcom/ds/TimeStamp.h
--- a/xpcom/ds/TimeStamp.h
+++ b/xpcom/ds/TimeStamp.h
@@ -73,16 +73,20 @@ public:
   static inline TimeDuration FromSeconds(double aSeconds) {
     return FromMilliseconds(aSeconds * 1000.0);
   }
   static TimeDuration FromMilliseconds(double aMilliseconds);
   static inline TimeDuration FromMicroseconds(double aMicroseconds) {
     return FromMilliseconds(aMicroseconds / 1000.0);
   }
 
+  static TimeDuration Forever() {
+    return FromTicks(INT64_MAX);
+  }
+
   TimeDuration operator+(const TimeDuration& aOther) const {
     return TimeDuration::FromTicks(mValue + aOther.mValue);
   }
   TimeDuration operator-(const TimeDuration& aOther) const {
     return TimeDuration::FromTicks(mValue - aOther.mValue);
   }
   TimeDuration& operator+=(const TimeDuration& aOther) {
     mValue += aOther.mValue;
@@ -109,17 +113,17 @@ public:
     return TimeDuration::FromTicks(mValue * int64_t(aMultiplier));
   }
   TimeDuration operator*(const int64_t aMultiplier) const {
     return TimeDuration::FromTicks(mValue * int64_t(aMultiplier));
   }
   TimeDuration operator/(const int64_t aDivisor) const {
     return TimeDuration::FromTicks(mValue / aDivisor);
   }
-  double operator/(const TimeDuration& aOther) {
+  double operator/(const TimeDuration& aOther) const {
     return static_cast<double>(mValue) / aOther.mValue;
   }
 
   bool operator<(const TimeDuration& aOther) const {
     return mValue < aOther.mValue;
   }
   bool operator<=(const TimeDuration& aOther) const {
     return mValue <= aOther.mValue;