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

Unified Diff: components/policy/core/common/cloud/cloud_policy_validator.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_validator.cc
diff --git a/components/policy/core/common/cloud/cloud_policy_validator.cc b/components/policy/core/common/cloud/cloud_policy_validator.cc
index bcd24b23f834e397ad486c0e6fb789d0de995673..8a51556ed1b9282de9260926bdd0f5d957a2f821 100644
--- a/components/policy/core/common/cloud/cloud_policy_validator.cc
+++ b/components/policy/core/common/cloud/cloud_policy_validator.cc
@@ -53,8 +53,7 @@ void CloudPolicyValidatorBase::ValidateTimestamp(
base::Time not_before,
ValidateTimestampOption timestamp_option) {
validation_flags_ |= VALIDATE_TIMESTAMP;
- timestamp_not_before_ =
- (not_before - base::Time::UnixEpoch()).InMilliseconds();
+ timestamp_not_before_ = not_before.ToJavaTime();
timestamp_option_ = timestamp_option;
}
@@ -146,9 +145,7 @@ void CloudPolicyValidatorBase::ValidateAgainstCurrentPolicy(
std::string expected_dm_token;
std::string expected_device_id;
if (policy_data) {
- last_policy_timestamp =
- base::Time::UnixEpoch() +
- base::TimeDelta::FromMilliseconds(policy_data->timestamp());
+ last_policy_timestamp = base::Time::FromJavaTime(policy_data->timestamp());
expected_dm_token = policy_data->request_token();
expected_device_id = policy_data->device_id();
}

Powered by Google App Engine
This is Rietveld 408576698