| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace | 215 } // namespace |
| 216 | 216 |
| 217 int main(int argc, char* argv[]) { | 217 int main(int argc, char* argv[]) { |
| 218 #if defined(OS_MACOSX) | 218 #if defined(OS_MACOSX) |
| 219 base::mac::ScopedNSAutoreleasePool pool; | 219 base::mac::ScopedNSAutoreleasePool pool; |
| 220 #endif | 220 #endif |
| 221 | 221 |
| 222 base::AtExitManager exit_manager; | 222 base::AtExitManager exit_manager; |
| 223 CommandLine::Init(argc, argv); | 223 base::CommandLine::Init(argc, argv); |
| 224 logging::LoggingSettings settings; | 224 logging::LoggingSettings settings; |
| 225 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 225 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 226 logging::InitLogging(settings); | 226 logging::InitLogging(settings); |
| 227 | 227 |
| 228 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 228 const base::CommandLine& parsed_command_line = |
| 229 *base::CommandLine::ForCurrentProcess(); |
| 229 GURL url(parsed_command_line.GetSwitchValueASCII("url")); | 230 GURL url(parsed_command_line.GetSwitchValueASCII("url")); |
| 230 if (!url.is_valid() || | 231 if (!url.is_valid() || |
| 231 (url.scheme() != "http" && url.scheme() != "https")) { | 232 (url.scheme() != "http" && url.scheme() != "https")) { |
| 232 std::fprintf( | 233 std::fprintf( |
| 233 stderr, | 234 stderr, |
| 234 "Usage: %s --url=[http|https]://www.example.com [--v=[1|2]]\n", | 235 "Usage: %s --url=[http|https]://www.example.com [--v=[1|2]]\n", |
| 235 argv[0]); | 236 argv[0]); |
| 236 return EXIT_FAILURE; | 237 return EXIT_FAILURE; |
| 237 } | 238 } |
| 238 | 239 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 &skew, &skew_uncertainty); | 337 &skew, &skew_uncertainty); |
| 337 | 338 |
| 338 std::printf( | 339 std::printf( |
| 339 "An estimate for the local clock skew is %.2f ms with " | 340 "An estimate for the local clock skew is %.2f ms with " |
| 340 "uncertainty %.2f ms\n", | 341 "uncertainty %.2f ms\n", |
| 341 skew.InMillisecondsF(), | 342 skew.InMillisecondsF(), |
| 342 skew_uncertainty.InMillisecondsF()); | 343 skew_uncertainty.InMillisecondsF()); |
| 343 | 344 |
| 344 return EXIT_SUCCESS; | 345 return EXIT_SUCCESS; |
| 345 } | 346 } |
| OLD | NEW |