0
Files
src/components/ntp_snippets/time_serialization.h
Sky Malice 0ef461ea24 [NTP Snippets] Switch RemoteSuggestionsSchedulerImpl to Time and TimeDelta pref methods.
Because time_serialization.cc stored Time and DeltaTime in
microseconds, and Time since the windows epoch, which is the exact
same way that PrefService is storing these time fields, this change
should be fully backwards compatible.

Bug: 853755
Change-Id: I22d734d030ca550a654319e37abf6653890c1bdb
Reviewed-on: https://chromium-review.googlesource.com/1104581
Reviewed-by: Filip Gorski <fgorski@chromium.org>
Commit-Queue: Sky Malice <skym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568282}
2018-06-19 01:28:21 +00:00

23 lines
847 B
C++

// Copyright 2017 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.
#ifndef COMPONENTS_NTP_SNIPPETS_TIME_SERIALIZATION_H_
#define COMPONENTS_NTP_SNIPPETS_TIME_SERIALIZATION_H_
#include "base/time/time.h"
namespace ntp_snippets {
// Backward compatible replacements for deprecated
// base::Time::To/FromInternalValue. Only for serialization. Do not change them,
// because the values based on them are persisted in multiple places (e.g.
// prefs, on-disk database). The value repesents number of microseconds since
// 1st of January 1601 (aka Windows epoch).
int64_t SerializeTime(const base::Time& time);
base::Time DeserializeTime(int64_t serialized_time);
} // namespace ntp_snippets
#endif // COMPONENTS_NTP_SNIPPETS_TIME_SERIALIZATION_H_