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

Unified Diff: third_party/WebKit/Source/wtf/Time.h

Issue 2542693002: Use WTF::TimeTicks to represent timestamp in Platform/Core event types (Closed)
Patch Set: Add TimeTicks::{To,In}Seconds utility functions Created 4 years 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 | « third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/Time.h
diff --git a/third_party/WebKit/Source/wtf/Time.h b/third_party/WebKit/Source/wtf/Time.h
index 3bc5ae8c821e69001416ab360655be998ccc36fd..c8f69fac0e0537226ffcbc13b3731518142a0129 100644
--- a/third_party/WebKit/Source/wtf/Time.h
+++ b/third_party/WebKit/Source/wtf/Time.h
@@ -43,6 +43,15 @@ class TimeWrapper {
return m_value.ToInternalValue();
}
+ // Only use this conversion when interfacing with legacy code that represents
+ // time in double. Converting to double can lead to losing information for
+ // large time values.
+ double InSeconds() { return (m_value - WrappedTimeType()).InSecondsF(); }
esprehn 2016/12/12 22:12:21 const
+
+ static TimeWrapper FromSeconds(double seconds) {
+ return WrappedTimeType() + TimeDelta::FromSecondsD(seconds);
+ }
+
TimeWrapper& operator=(TimeWrapper other) {
m_value = other.m_value;
return *this;
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698