Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1420)

Unified Diff: base/time/time.h

Issue 231133002: CC::Animations should use TimeTicks & TimeDelta to represent time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code Refactored as per the comments. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/animation/animation.h » ('j') | cc/animation/animation.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | cc/animation/animation.h » ('j') | cc/animation/animation.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698