Index: base/time/time.h |
diff --git a/base/time/time.h b/base/time/time.h |
index 546920b2e92cac257663e7256da8cfa662f803f2..12ac1f024699635b2eb68a10f0cbcfb4028adf16 100644 |
--- a/base/time/time.h |
+++ b/base/time/time.h |
@@ -665,6 +665,19 @@ class BASE_EXPORT TimeTicks { |
return ticks_; |
} |
+ static double InSecondsF(TimeTicks time) { |
+ if (time.ToInternalValue() == std::numeric_limits<int64>::max()) { |
+ // Preserve max to prevent overflow. |
+ return std::numeric_limits<int>::max(); |
+ } |
+ return static_cast<double>(time.ToInternalValue()) / |
+ Time::kMicrosecondsPerSecond; |
+ } |
+ |
+ static TimeTicks FromSeconds(double seconds) { |
+ return TimeTicks::FromInternalValue(seconds * Time::kMicrosecondsPerSecond); |
+ } |
ajuma
2014/04/24 20:41:36
It's not obvious to me whether these are a good id
|
+ |
TimeTicks& operator=(TimeTicks other) { |
ticks_ = other.ticks_; |
return *this; |