Index: base/time/time.h |
diff --git a/base/time/time.h b/base/time/time.h |
index be0eb20f88a4df500d5dfe289fc0d35fed6acd64..9cc7dac704cd73c0169745418017d45a3bd361cf 100644 |
--- a/base/time/time.h |
+++ b/base/time/time.h |
@@ -119,17 +119,17 @@ class BASE_EXPORT TimeDelta { |
static TimeDelta FromQPCValue(LONGLONG qpc_value); |
#endif |
+ // Returns the maximum time delta, which should be greater than any reasonable |
+ // time delta we might compare it to. Adding or subtracting the maximum time |
+ // delta to a time or another time delta has an undefined result. |
+ static constexpr TimeDelta Max(); |
+ |
// Converts an integer value representing TimeDelta to a class. This is used |
// when deserializing a |TimeDelta| structure, using a value known to be |
// compatible. It is not provided as a constructor because the integer type |
// may be unclear from the perspective of a caller. |
static TimeDelta FromInternalValue(int64_t delta) { return TimeDelta(delta); } |
- // Returns the maximum time delta, which should be greater than any reasonable |
- // time delta we might compare it to. Adding or subtracting the maximum time |
- // delta to a time or another time delta has an undefined result. |
- static TimeDelta Max(); |
- |
// Returns the internal numeric value of the TimeDelta object. Please don't |
// use this and do arithmetic on it, as it is more error prone than using the |
// provided operators. |
@@ -654,6 +654,11 @@ constexpr TimeDelta TimeDelta::FromMicroseconds(int64_t us) { |
} |
// static |
+constexpr TimeDelta TimeDelta::Max() { |
+ return TimeDelta(std::numeric_limits<int64_t>::max()); |
+} |
+ |
+// static |
constexpr TimeDelta TimeDelta::FromDouble(double value) { |
// TODO(crbug.com/612601): Use saturated_cast<int64_t>(value) once we sort out |
// the Min() behavior. |