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

Side by Side Diff: components/history/core/browser/android/android_time.h

Issue 849323002: Componentize HistoryDatabase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android compilation Created 5 years, 11 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_HISTORY_CORE_ANDROID_ANDROID_TIME_H_ 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_TIME_H_
6 #define COMPONENTS_HISTORY_CORE_ANDROID_ANDROID_TIME_H_ 6 #define COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_TIME_H_
7 7
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 9
10 namespace history { 10 namespace history {
11 11
12 // Android's system time is the milliseconds since January 1, 1970 00:00:00 UTC, 12 // Android's system time is the milliseconds since January 1, 1970 00:00:00 UTC,
13 // the below 2 methods are used convert between base::Time and the milliseconds 13 // the below 2 methods are used convert between base::Time and the milliseconds
14 // stored in database. 14 // stored in database.
15 inline base::Time FromDatabaseTime(int64 milliseconds) { 15 inline base::Time FromDatabaseTime(int64 milliseconds) {
16 return base::TimeDelta::FromMilliseconds(milliseconds) + 16 return base::TimeDelta::FromMilliseconds(milliseconds) +
17 base::Time::UnixEpoch(); 17 base::Time::UnixEpoch();
18 } 18 }
19 19
20 inline int64 ToDatabaseTime(const base::Time& time) { 20 inline int64 ToDatabaseTime(const base::Time& time) {
21 return (time - base::Time::UnixEpoch()).InMilliseconds(); 21 return (time - base::Time::UnixEpoch()).InMilliseconds();
22 } 22 }
23 23
24 } // namespace history 24 } // namespace history
25 25
26 #endif // COMPONENTS_HISTORY_CORE_ANDROID_ANDROID_TIME_H_ 26 #endif // COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_TIME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698