Commit 28e6a8be authored by Mathieu Guay-Paquet's avatar Mathieu Guay-Paquet Committed by Commit Bot

Remove deprecated uses of Time::FromInternalValue()

The more explicit Time::FromDeltaSinceWindowsEpoch() is used instead,
and produces the same value given the same int64_t.

The registry keys consumed by this code are written by code in
chrome/chrome_cleaner/logging/registry_logger.cc (not yet moved there
from the internal repo), which already uses the corresponding
Time::ToDeltaSinceWindowsEpoch().

Bug: 634507
Change-Id: I75348bf8e55a0cc3d93412563e5527ddb04ce390
Reviewed-on: https://chromium-review.googlesource.com/1156861
Commit-Queue: Mathieu Guay-Paquet <mguaypaq@chromium.org>
Reviewed-by: default avatarJoe Mason <joenotcharles@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581657}
parent d267fd99
...@@ -471,6 +471,8 @@ void ReportUMAForLastCleanerRun() { ...@@ -471,6 +471,8 @@ void ReportUMAForLastCleanerRun() {
int64_t start_time_value = {}; int64_t start_time_value = {};
cleaner_key.ReadInt64(chrome_cleaner::kStartTimeValueName, cleaner_key.ReadInt64(chrome_cleaner::kStartTimeValueName,
&start_time_value); &start_time_value);
const base::Time start_time = base::Time::FromDeltaSinceWindowsEpoch(
base::TimeDelta::FromMicroseconds(start_time_value));
const bool completed = const bool completed =
cleaner_key.HasValue(chrome_cleaner::kEndTimeValueName); cleaner_key.HasValue(chrome_cleaner::kEndTimeValueName);
...@@ -479,12 +481,12 @@ void ReportUMAForLastCleanerRun() { ...@@ -479,12 +481,12 @@ void ReportUMAForLastCleanerRun() {
int64_t end_time_value = {}; int64_t end_time_value = {};
cleaner_key.ReadInt64(chrome_cleaner::kEndTimeValueName, cleaner_key.ReadInt64(chrome_cleaner::kEndTimeValueName,
&end_time_value); &end_time_value);
const base::Time end_time = base::Time::FromDeltaSinceWindowsEpoch(
base::TimeDelta::FromMicroseconds(end_time_value));
cleaner_key.DeleteValue(chrome_cleaner::kEndTimeValueName); cleaner_key.DeleteValue(chrome_cleaner::kEndTimeValueName);
const base::TimeDelta run_time =
base::Time::FromInternalValue(end_time_value) -
base::Time::FromInternalValue(start_time_value);
UMA_HISTOGRAM_LONG_TIMES("SoftwareReporter.Cleaner.RunningTime", UMA_HISTOGRAM_LONG_TIMES("SoftwareReporter.Cleaner.RunningTime",
run_time); end_time - start_time);
} }
// Get exit code. Assume nothing was found if we can't read the exit code. // Get exit code. Assume nothing was found if we can't read the exit code.
DWORD exit_code = chrome_cleaner::kSwReporterNothingFound; DWORD exit_code = chrome_cleaner::kSwReporterNothingFound;
...@@ -500,8 +502,7 @@ void ReportUMAForLastCleanerRun() { ...@@ -500,8 +502,7 @@ void ReportUMAForLastCleanerRun() {
exit_code == exit_code ==
chrome_cleaner::kSwReporterDelayedPostRebootCleanupNeeded) { chrome_cleaner::kSwReporterDelayedPostRebootCleanupNeeded) {
// Check if we are running after the user has rebooted. // Check if we are running after the user has rebooted.
const base::TimeDelta elapsed = const base::TimeDelta elapsed = base::Time::Now() - start_time;
base::Time::Now() - base::Time::FromInternalValue(start_time_value);
DCHECK_GT(elapsed.InMilliseconds(), 0); DCHECK_GT(elapsed.InMilliseconds(), 0);
UMA_HISTOGRAM_BOOLEAN( UMA_HISTOGRAM_BOOLEAN(
"SoftwareReporter.Cleaner.HasRebooted", "SoftwareReporter.Cleaner.HasRebooted",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment