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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 } // namespace | 224 } // namespace |
225 | 225 |
226 int main(int argc, char* argv[]) { | 226 int main(int argc, char* argv[]) { |
227 #if defined(OS_MACOSX) | 227 #if defined(OS_MACOSX) |
228 base::mac::ScopedNSAutoreleasePool pool; | 228 base::mac::ScopedNSAutoreleasePool pool; |
229 #endif | 229 #endif |
230 | 230 |
231 base::AtExitManager exit_manager; | 231 base::AtExitManager exit_manager; |
232 CommandLine::Init(argc, argv); | 232 CommandLine::Init(argc, argv); |
233 logging::InitLogging( | 233 logging::LoggingSettings settings; |
234 NULL, | 234 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
235 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 235 logging::InitLogging(settings); |
236 logging::LOCK_LOG_FILE, | |
237 logging::DELETE_OLD_LOG_FILE, | |
238 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | |
239 | 236 |
240 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 237 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
241 GURL url(parsed_command_line.GetSwitchValueASCII("url")); | 238 GURL url(parsed_command_line.GetSwitchValueASCII("url")); |
242 if (!url.is_valid() || | 239 if (!url.is_valid() || |
243 (url.scheme() != "http" && url.scheme() != "https")) { | 240 (url.scheme() != "http" && url.scheme() != "https")) { |
244 std::fprintf( | 241 std::fprintf( |
245 stderr, | 242 stderr, |
246 "Usage: %s --url=[http|https]://www.example.com [--v=[1|2]]\n", | 243 "Usage: %s --url=[http|https]://www.example.com [--v=[1|2]]\n", |
247 argv[0]); | 244 argv[0]); |
248 return EXIT_FAILURE; | 245 return EXIT_FAILURE; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 &skew, &skew_uncertainty); | 345 &skew, &skew_uncertainty); |
349 | 346 |
350 std::printf( | 347 std::printf( |
351 "An estimate for the local clock skew is %.2f ms with " | 348 "An estimate for the local clock skew is %.2f ms with " |
352 "uncertainty %.2f ms\n", | 349 "uncertainty %.2f ms\n", |
353 skew.InMillisecondsF(), | 350 skew.InMillisecondsF(), |
354 skew_uncertainty.InMillisecondsF()); | 351 skew_uncertainty.InMillisecondsF()); |
355 | 352 |
356 return EXIT_SUCCESS; | 353 return EXIT_SUCCESS; |
357 } | 354 } |
OLD | NEW |