blob: ba86b69f3d5f12cced50e7da3035b0a2415b03f5 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/ntp_snippets/time_serialization.h"
namespace ntp_snippets {
int64_t SerializeTime(const base::Time& time) {
base::TimeDelta delta = time - base::Time();
return delta.InMicroseconds();
}
base::Time DeserializeTime(int64_t serialized_time) {
return base::Time() + base::TimeDelta::FromMicroseconds(serialized_time);
}
} // namespace ntp_snippets