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

Side by Side Diff: base/time_win.cc

Issue 3083002: GTTF: Increase the limit for QPC drift.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 5
6 // Windows Timer Primer 6 // Windows Timer Primer
7 // 7 //
8 // A good article: http://www.ddj.com/windows/184416651 8 // A good article: http://www.ddj.com/windows/184416651
9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258 9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258
10 // 10 //
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 bool IsUsingHighResClock() { 325 bool IsUsingHighResClock() {
326 return ticks_per_microsecond_ != 0.0; 326 return ticks_per_microsecond_ != 0.0;
327 } 327 }
328 328
329 void DisableHighResClock() { 329 void DisableHighResClock() {
330 ticks_per_microsecond_ = 0.0; 330 ticks_per_microsecond_ = 0.0;
331 } 331 }
332 332
333 TimeDelta Now() { 333 TimeDelta Now() {
334 // Our maximum tolerance for QPC drifting. 334 // Our maximum tolerance for QPC drifting.
335 const int kMaxTimeDrift = 50 * Time::kMicrosecondsPerMillisecond; 335 const int kMaxTimeDriftMicroseconds = 60150;
336 336
337 if (IsUsingHighResClock()) { 337 if (IsUsingHighResClock()) {
338 int64 now = UnreliableNow(); 338 int64 now = UnreliableNow();
339 339
340 // Verify that QPC does not seem to drift. 340 // Verify that QPC does not seem to drift.
341 DCHECK_LT(now - ReliableNow() - skew_, kMaxTimeDrift); 341 DCHECK_LT(abs((now - ReliableNow()) - skew_), kMaxTimeDriftMicroseconds);
342 342
343 return TimeDelta::FromMicroseconds(now); 343 return TimeDelta::FromMicroseconds(now);
344 } 344 }
345 345
346 // Just fallback to the slower clock. 346 // Just fallback to the slower clock.
347 return RolloverProtectedNow(); 347 return RolloverProtectedNow();
348 } 348 }
349 349
350 private: 350 private:
351 // Synchronize the QPC clock with GetSystemTimeAsFileTime. 351 // Synchronize the QPC clock with GetSystemTimeAsFileTime.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 391
392 // static 392 // static
393 TimeTicks TimeTicks::Now() { 393 TimeTicks TimeTicks::Now() {
394 return TimeTicks() + RolloverProtectedNow(); 394 return TimeTicks() + RolloverProtectedNow();
395 } 395 }
396 396
397 // static 397 // static
398 TimeTicks TimeTicks::HighResNow() { 398 TimeTicks TimeTicks::HighResNow() {
399 return TimeTicks() + Singleton<HighResNowSingleton>::get()->Now(); 399 return TimeTicks() + Singleton<HighResNowSingleton>::get()->Now();
400 } 400 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698