| OLD | NEW |
| 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 // This is a small utility that snarfs the server time from the | 5 // This is a small utility that snarfs the server time from the |
| 6 // response headers of an http/https HEAD request and compares it to | 6 // response headers of an http/https HEAD request and compares it to |
| 7 // the local time. | 7 // the local time. |
| 8 // | 8 // |
| 9 // TODO(akalin): Also snarf the server time from the TLS handshake, if | 9 // TODO(akalin): Also snarf the server time from the TLS handshake, if |
| 10 // any (http://crbug.com/146090). | 10 // any (http://crbug.com/146090). |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 const char* const source_type = | 116 const char* const source_type = |
| 117 net::NetLog::SourceTypeToString(entry.source().type); | 117 net::NetLog::SourceTypeToString(entry.source().type); |
| 118 const char* const event_type = | 118 const char* const event_type = |
| 119 net::NetLog::EventTypeToString(entry.type()); | 119 net::NetLog::EventTypeToString(entry.type()); |
| 120 const char* const event_phase = | 120 const char* const event_phase = |
| 121 net::NetLog::EventPhaseToString(entry.phase()); | 121 net::NetLog::EventPhaseToString(entry.phase()); |
| 122 scoped_ptr<base::Value> params(entry.ParametersToValue()); | 122 scoped_ptr<base::Value> params(entry.ParametersToValue()); |
| 123 std::string params_str; | 123 std::string params_str; |
| 124 if (params.get()) { | 124 if (params.get()) { |
| 125 base::JSONWriter::Write(params.get(), ¶ms_str); | 125 base::JSONWriter::Write(*params, ¶ms_str); |
| 126 params_str.insert(0, ": "); | 126 params_str.insert(0, ": "); |
| 127 } | 127 } |
| 128 | 128 |
| 129 VLOG(1) << source_type << "(" << entry.source().id << "): " | 129 VLOG(1) << source_type << "(" << entry.source().id << "): " |
| 130 << event_type << ": " << event_phase << params_str; | 130 << event_type << ": " << event_phase << params_str; |
| 131 } | 131 } |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 DISALLOW_COPY_AND_ASSIGN(PrintingLogObserver); | 134 DISALLOW_COPY_AND_ASSIGN(PrintingLogObserver); |
| 135 }; | 135 }; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 &skew, &skew_uncertainty); | 317 &skew, &skew_uncertainty); |
| 318 | 318 |
| 319 std::printf( | 319 std::printf( |
| 320 "An estimate for the local clock skew is %.2f ms with " | 320 "An estimate for the local clock skew is %.2f ms with " |
| 321 "uncertainty %.2f ms\n", | 321 "uncertainty %.2f ms\n", |
| 322 skew.InMillisecondsF(), | 322 skew.InMillisecondsF(), |
| 323 skew_uncertainty.InMillisecondsF()); | 323 skew_uncertainty.InMillisecondsF()); |
| 324 | 324 |
| 325 return EXIT_SUCCESS; | 325 return EXIT_SUCCESS; |
| 326 } | 326 } |
| OLD | NEW |