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

Side by Side Diff: net/tools/get_server_time/get_server_time.cc

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 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
« no previous file with comments | « net/tools/flip_server/mem_cache.cc ('k') | net/tools/net_watcher/net_watcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 scoped_ptr<net::URLFetcher> fetcher = 233 scoped_ptr<net::URLFetcher> fetcher =
234 net::URLFetcher::Create(url, net::URLFetcher::HEAD, &delegate); 234 net::URLFetcher::Create(url, net::URLFetcher::HEAD, &delegate);
235 scoped_ptr<net::URLRequestContext> url_request_context( 235 scoped_ptr<net::URLRequestContext> url_request_context(
236 BuildURLRequestContext(&net_log)); 236 BuildURLRequestContext(&net_log));
237 fetcher->SetRequestContext( 237 fetcher->SetRequestContext(
238 // Since there's only a single thread, there's no need to worry 238 // Since there's only a single thread, there's no need to worry
239 // about when the URLRequestContext gets created. 239 // about when the URLRequestContext gets created.
240 // The URLFetcher will take a reference on the object, and hence 240 // The URLFetcher will take a reference on the object, and hence
241 // implicitly take ownership. 241 // implicitly take ownership.
242 new net::TrivialURLRequestContextGetter(url_request_context.get(), 242 new net::TrivialURLRequestContextGetter(url_request_context.get(),
243 main_loop.message_loop_proxy())); 243 main_loop.task_runner()));
244 const base::Time start_time = base::Time::Now(); 244 const base::Time start_time = base::Time::Now();
245 const base::TimeTicks start_ticks = base::TimeTicks::Now(); 245 const base::TimeTicks start_ticks = base::TimeTicks::Now();
246 246
247 fetcher->Start(); 247 fetcher->Start();
248 std::printf( 248 std::printf(
249 "Request started at %s (ticks = %" PRId64 ")\n", 249 "Request started at %s (ticks = %" PRId64 ")\n",
250 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(start_time)).c_str(), 250 UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(start_time)).c_str(),
251 start_ticks.ToInternalValue()); 251 start_ticks.ToInternalValue());
252 252
253 // |delegate| quits |main_loop| when the request is done. 253 // |delegate| quits |main_loop| when the request is done.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « net/tools/flip_server/mem_cache.cc ('k') | net/tools/net_watcher/net_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698