Index: cc/base/time_util.h |
diff --git a/cc/base/time_util.h b/cc/base/time_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1e460bfaecd64276c2a46d64ce4eced634ea392b |
--- /dev/null |
+++ b/cc/base/time_util.h |
@@ -0,0 +1,36 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_BASE_TIME_UTIL_H_ |
+#define CC_BASE_TIME_UTIL_H_ |
+ |
+namespace base { |
+class TimeDelta; |
+} |
+ |
+namespace cc { |
+ |
+base::TimeDelta operator*(const base::TimeDelta time_delta, double value) { |
ajuma
2014/11/06 18:03:23
Rather than overloading operator* (which will be c
patro
2014/11/07 07:03:40
Done.
|
+ return base::TimeDelta::FromInternalValue(time_delta.ToInternalValue() * |
ajuma
2014/11/06 18:03:23
Make the double/int64 conversions explicit, e.g:
ajuma
2014/11/06 18:07:20
Sorry, messed up the parentheses there. I meant:
b
patro
2014/11/07 07:03:40
Done.
|
+ value); |
+} |
+ |
+base::TimeDelta operator*(double value, const base::TimeDelta time_delta) { |
+ return base::TimeDelta::FromInternalValue(time_delta.ToInternalValue() * |
+ value); |
+} |
+ |
+base::TimeDelta operator/(const base::TimeDelta time_delta, double value) { |
+ return base::TimeDelta::FromInternalValue(time_delta.ToInternalValue() / |
+ value); |
+} |
+ |
+base::TimeDelta operator/(double value, const base::TimeDelta time_delta) { |
+ return base::TimeDelta::FromInternalValue(time_delta.ToInternalValue() / |
+ value); |
+} |
+ |
+} // namespace cc |
+ |
+#endif // CC_BASE_TIME_UTIL_H_ |