OLD | NEW |
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_BROWSER_ANDROID_ANDROID_TIME_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_TIME_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_TIME_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_TIME_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "base/time/time.h" | 10 #include "base/time/time.h" |
9 | 11 |
10 namespace history { | 12 namespace history { |
11 | 13 |
12 // Android's system time is the milliseconds since January 1, 1970 00:00:00 UTC, | 14 // 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 | 15 // the below 2 methods are used convert between base::Time and the milliseconds |
14 // stored in database. | 16 // stored in database. |
15 inline base::Time FromDatabaseTime(int64 milliseconds) { | 17 inline base::Time FromDatabaseTime(int64_t milliseconds) { |
16 return base::TimeDelta::FromMilliseconds(milliseconds) + | 18 return base::TimeDelta::FromMilliseconds(milliseconds) + |
17 base::Time::UnixEpoch(); | 19 base::Time::UnixEpoch(); |
18 } | 20 } |
19 | 21 |
20 inline int64 ToDatabaseTime(const base::Time& time) { | 22 inline int64_t ToDatabaseTime(const base::Time& time) { |
21 return (time - base::Time::UnixEpoch()).InMilliseconds(); | 23 return (time - base::Time::UnixEpoch()).InMilliseconds(); |
22 } | 24 } |
23 | 25 |
24 } // namespace history | 26 } // namespace history |
25 | 27 |
26 #endif // COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_TIME_H_ | 28 #endif // COMPONENTS_HISTORY_CORE_BROWSER_ANDROID_ANDROID_TIME_H_ |
OLD | NEW |