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

Unified Diff: components/policy/core/common/cloud/cloud_policy_refresh_scheduler.cc

Issue 2830033003: Use {To/From}JavaTime for policy timestamps (Closed)
Patch Set: Rebase Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/policy/core/common/cloud/cloud_policy_refresh_scheduler.cc
diff --git a/components/policy/core/common/cloud/cloud_policy_refresh_scheduler.cc b/components/policy/core/common/cloud/cloud_policy_refresh_scheduler.cc
index 2f69cd7a155ce3bb595f8daab176547d11114083..bf1ac8561922336ae544b0ce9e7029ecfb5919ca 100644
--- a/components/policy/core/common/cloud/cloud_policy_refresh_scheduler.cc
+++ b/components/policy/core/common/cloud/cloud_policy_refresh_scheduler.cc
@@ -239,9 +239,7 @@ void CloudPolicyRefreshScheduler::UpdateLastRefreshFromPolicy() {
// fetching again on startup; the Android logic differs from the desktop in
// this aspect.
if (store_->has_policy() && store_->policy()->has_timestamp()) {
- last_refresh_ =
- base::Time::UnixEpoch() +
- base::TimeDelta::FromMilliseconds(store_->policy()->timestamp());
+ last_refresh_ = base::Time::FromJavaTime(store_->policy()->timestamp());
last_refresh_ticks_ = base::TimeTicks::Now() +
(last_refresh_ - base::Time::NowFromSystemTime());
}
@@ -251,9 +249,7 @@ void CloudPolicyRefreshScheduler::UpdateLastRefreshFromPolicy() {
// immediate refresh is intentional.
if (store_->has_policy() && store_->policy()->has_timestamp() &&
!store_->is_managed()) {
- last_refresh_ =
- base::Time::UnixEpoch() +
- base::TimeDelta::FromMilliseconds(store_->policy()->timestamp());
+ last_refresh_ = base::Time::FromJavaTime(store_->policy()->timestamp());
last_refresh_ticks_ = base::TimeTicks::Now() +
(last_refresh_ - base::Time::NowFromSystemTime());
}

Powered by Google App Engine
This is Rietveld 408576698