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

Unified Diff: base/time/time.cc

Issue 2548213005: Add base::time::FromJavaTime (Closed)
Patch Set: 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 | « base/time/time.h ('k') | chrome/browser/android/ntp/ntp_snippets_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time/time.cc
diff --git a/base/time/time.cc b/base/time/time.cc
index 4e942015fcf578015138c7a824ea65ac6b416b8c..ba129954235f2c82db3f67ea4816540d87783ce8 100644
--- a/base/time/time.cc
+++ b/base/time/time.cc
@@ -203,6 +203,11 @@ double Time::ToJsTime() const {
kMicrosecondsPerMillisecond);
}
+Time Time::FromJavaTime(int64_t ms_since_epoch) {
+ return base::Time::UnixEpoch() +
+ base::TimeDelta::FromMilliseconds(ms_since_epoch);
+}
+
int64_t Time::ToJavaTime() const {
if (is_null()) {
// Preserve 0 so the invalid result doesn't depend on the platform.
« no previous file with comments | « base/time/time.h ('k') | chrome/browser/android/ntp/ntp_snippets_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698