Chromium Code Reviews| Index: base/time_win.cc |
| =================================================================== |
| --- base/time_win.cc (revision 54549) |
| +++ base/time_win.cc (working copy) |
| @@ -331,22 +331,20 @@ |
| } |
| TimeDelta Now() { |
| - // Our maximum tolerance for QPC drifting. |
| - const int kMaxTimeDriftMicroseconds = 60150; |
| + if (IsUsingHighResClock()) |
| + return TimeDelta::FromMicroseconds(UnreliableNow()); |
| - if (IsUsingHighResClock()) { |
| - int64 now = UnreliableNow(); |
| - |
| - // Verify that QPC does not seem to drift. |
| - DCHECK_LT(abs((now - ReliableNow()) - skew_), kMaxTimeDriftMicroseconds); |
| - |
| - return TimeDelta::FromMicroseconds(now); |
| - } |
| - |
| // Just fallback to the slower clock. |
| return RolloverProtectedNow(); |
| } |
| + int64 GetQPCDriftMicroseconds() { |
| + if (!IsUsingHighResClock()) |
| + return 0; |
| + |
| + return abs((UnreliableNow() - ReliableNow()) - skew_); |
|
brettw
2010/08/03 18:17:35
Is this right? It seems like the sign of Unreliabl
cpu_(ooo_6.6-7.5)
2010/08/04 17:44:42
Seems ok to me. You *could* remove the outer abs()
|
| + } |
| + |
| private: |
| // Synchronize the QPC clock with GetSystemTimeAsFileTime. |
| void InitializeClock() { |
| @@ -398,3 +396,8 @@ |
| TimeTicks TimeTicks::HighResNow() { |
| return TimeTicks() + Singleton<HighResNowSingleton>::get()->Now(); |
| } |
| + |
| +// static |
| +int64 TimeTicks::GetQPCDriftMicroseconds() { |
| + return Singleton<HighResNowSingleton>::get()->GetQPCDriftMicroseconds(); |
| +} |