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

Side by Side Diff: chrome/browser/chromeos/policy/device_status_collector.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/policy/device_status_collector.h" 5 #include "chrome/browser/chromeos/policy/device_status_collector.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const char kCPUTempFilePattern[] = "temp*_input"; 99 const char kCPUTempFilePattern[] = "temp*_input";
100 100
101 // Determine the day key (milliseconds since epoch for corresponding day in UTC) 101 // Determine the day key (milliseconds since epoch for corresponding day in UTC)
102 // for a given |timestamp|. 102 // for a given |timestamp|.
103 int64_t TimestampToDayKey(Time timestamp) { 103 int64_t TimestampToDayKey(Time timestamp) {
104 Time::Exploded exploded; 104 Time::Exploded exploded;
105 timestamp.LocalMidnight().LocalExplode(&exploded); 105 timestamp.LocalMidnight().LocalExplode(&exploded);
106 Time out_time; 106 Time out_time;
107 bool conversion_success = Time::FromUTCExploded(exploded, &out_time); 107 bool conversion_success = Time::FromUTCExploded(exploded, &out_time);
108 DCHECK(conversion_success); 108 DCHECK(conversion_success);
109 return (out_time - Time::UnixEpoch()).InMilliseconds(); 109 return out_time.ToJavaTime();
110 } 110 }
111 111
112 // Helper function (invoked via blocking pool) to fetch information about 112 // Helper function (invoked via blocking pool) to fetch information about
113 // mounted disks. 113 // mounted disks.
114 std::vector<em::VolumeInfo> GetVolumeInfo( 114 std::vector<em::VolumeInfo> GetVolumeInfo(
115 const std::vector<std::string>& mount_points) { 115 const std::vector<std::string>& mount_points) {
116 std::vector<em::VolumeInfo> result; 116 std::vector<em::VolumeInfo> result;
117 for (const std::string& mount_point : mount_points) { 117 for (const std::string& mount_point : mount_points) {
118 base::FilePath mount_path(mount_point); 118 base::FilePath mount_path(mount_point);
119 119
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 1268
1269 void DeviceStatusCollector::OnOSVersion(const std::string& version) { 1269 void DeviceStatusCollector::OnOSVersion(const std::string& version) {
1270 os_version_ = version; 1270 os_version_ = version;
1271 } 1271 }
1272 1272
1273 void DeviceStatusCollector::OnOSFirmware(const std::string& version) { 1273 void DeviceStatusCollector::OnOSFirmware(const std::string& version) {
1274 firmware_version_ = version; 1274 firmware_version_ = version;
1275 } 1275 }
1276 1276
1277 } // namespace policy 1277 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698