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

Side by Side Diff: cc/base/time_util.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: Self review changes. Created 6 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_BASE_TIME_UTIL_H_
6 #define CC_BASE_TIME_UTIL_H_
7
8 #include <limits>
9 #include "base/time/time.h"
10
11 namespace cc {
12
13 class CC_EXPORT TimeUtil {
14 public:
15 static double TicksInSecondsF(base::TimeTicks time) {
ajuma 2014/05/05 15:13:32 A previous CL that added similar functions was rej
Sikugu_ 2014/05/07 14:49:07 Done.
16 if (time.ToInternalValue() == std::numeric_limits<int64>::max()) {
17 // Preserve max to prevent overflow.
18 return std::numeric_limits<int>::max();
19 }
20 return static_cast<double>(time.ToInternalValue()) /
21 base::Time::kMicrosecondsPerSecond;
22 }
23
24 static base::TimeTicks TicksFromSecondsF(double seconds) {
25 return base::TimeTicks::FromInternalValue(
26 seconds * base::Time::kMicrosecondsPerSecond);
27 }
28 };
29
30 } // namespace cc
31
32 #endif // CC_BASE_TIME_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698