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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_HISTORY_ANDROID_ANDROID_TIME_H_
6 #define CHROME_BROWSER_HISTORY_ANDROID_ANDROID_TIME_H_
8 #include "base/time/time.h"
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
14 // stored in database.
15 inline base::Time FromDatabaseTime(int64 milliseconds) {
16 return base::TimeDelta::FromMilliseconds(milliseconds) +
17 base::Time::UnixEpoch();
20 inline int64 ToDatabaseTime(const base::Time& time) {
21 return (time - base::Time::UnixEpoch()).InMilliseconds();
24 } // namespace history
26 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_TIME_H_