diff options
author | 2015-10-22 13:03:02 -0700 | |
---|---|---|
committer | 2015-10-22 13:03:02 -0700 | |
commit | 6ae30fbbafe9aa9596922ac96ecaae0278b7be65 (patch) | |
tree | c2944e2bc22e8b64ad07dc9b6e9275a0c52dedf6 /src/animator | |
parent | 70084cbc16ee8162649f2601377feb6e49de0217 (diff) |
Revert of SkTime::GetNSecs() (patchset #9 id:160001 of https://codereview.chromium.org/1422513003/ )
Reason for revert:
broke chromeos
Original issue's description:
> SkTime::GetNSecs()
>
> - Move high-precision wall timers from tools/timer to SkTime.
> - Implement SkTime::GetMSecs() in terms of SkTime::GetNSecs().
> - Delete unused tools/timer code.
>
> I have no idea what's going on there in src/animator.
> I don't intend to investigate.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/70084cbc16ee8162649f2601377feb6e49de0217
TBR=reed@google.com,mtklein@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1420923003
Diffstat (limited to 'src/animator')
-rw-r--r-- | src/animator/SkTime.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/animator/SkTime.cpp b/src/animator/SkTime.cpp index 560ccd2fc8..a4e035bd1e 100644 --- a/src/animator/SkTime.cpp +++ b/src/animator/SkTime.cpp @@ -28,6 +28,15 @@ void SkTime::GetDateTime(DateTime* t) { } } +SkMSec SkTime::GetMSecs() { +#ifdef SK_DEBUG + if (gForceTickCount != (SkMSec) -1) { + return gForceTickCount; + } +#endif + return ::GetTickCount(); +} + #elif defined(xSK_BUILD_FOR_MAC) #include <time.h> @@ -49,4 +58,13 @@ void SkTime::GetDateTime(DateTime* t) { } } +SkMSec SkTime::GetMSecs() { + UnsignedWide wide; + ::Microseconds(&wide); + + int64_t s = ((int64_t)wide.hi << 32) | wide.lo; + s = (s + 500) / 1000; // rounded divide + return (SkMSec)s; +} + #endif |