diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 22:17:18 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 22:17:18 +0000 |
commit | 0b2a2f4907087f36cd185bacbd685930eb7cbb31 (patch) | |
tree | fa5911a40aa50c3272b12d24ccabc98b1c4b9472 /base/time_win.cc | |
parent | ec707950fa24bcda70344b07f88f619117343a4f (diff) | |
download | chromium_src-0b2a2f4907087f36cd185bacbd685930eb7cbb31.zip chromium_src-0b2a2f4907087f36cd185bacbd685930eb7cbb31.tar.gz chromium_src-0b2a2f4907087f36cd185bacbd685930eb7cbb31.tar.bz2 |
GTTF: Avoid assertion failures caused by clock drift.
Instead, we add a test dedicated to verifying the QPC
time drift. Otherwise the assertion is being flakily hit
in unrelated tests, which crashes the entire test binary.
With a dedicated test, we still have necessary monitoring,
but it's in one place.
TEST=base_unittests, net_unittests (stop crashing)
BUG=none
Review URL: http://codereview.chromium.org/3082014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time_win.cc')
-rw-r--r-- | base/time_win.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/base/time_win.cc b/base/time_win.cc index e28835a..00868f6 100644 --- a/base/time_win.cc +++ b/base/time_win.cc @@ -331,22 +331,20 @@ class HighResNowSingleton { } TimeDelta Now() { - // Our maximum tolerance for QPC drifting. - const int kMaxTimeDriftMicroseconds = 60150; - - if (IsUsingHighResClock()) { - int64 now = UnreliableNow(); - - // Verify that QPC does not seem to drift. - DCHECK_LT(abs((now - ReliableNow()) - skew_), kMaxTimeDriftMicroseconds); - - return TimeDelta::FromMicroseconds(now); - } + if (IsUsingHighResClock()) + return TimeDelta::FromMicroseconds(UnreliableNow()); // Just fallback to the slower clock. return RolloverProtectedNow(); } + int64 GetQPCDriftMicroseconds() { + if (!IsUsingHighResClock()) + return 0; + + return abs((UnreliableNow() - ReliableNow()) - skew_); + } + private: // Synchronize the QPC clock with GetSystemTimeAsFileTime. void InitializeClock() { @@ -398,3 +396,8 @@ TimeTicks TimeTicks::Now() { TimeTicks TimeTicks::HighResNow() { return TimeTicks() + Singleton<HighResNowSingleton>::get()->Now(); } + +// static +int64 TimeTicks::GetQPCDriftMicroseconds() { + return Singleton<HighResNowSingleton>::get()->GetQPCDriftMicroseconds(); +}
\ No newline at end of file |