Changeset 88199 in webkit
- Timestamp:
- Jun 6, 2011, 4:04:58 PM (15 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/wtf/CurrentTime.cpp (modified) (2 diffs)
-
JavaScriptCore/wtf/CurrentTime.h (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/chromium/SystemTimeChromium.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r88151 r88199 1 2011-06-06 James Simonsen <simonjam@chromium.org> 2 3 Reviewed by James Robinson. 4 5 Add monotonicallyIncreasingTime() to get monotonically increasing time 6 https://bugs.webkit.org/show_bug.cgi?id=37743 7 8 * wtf/CurrentTime.cpp: Add monotonicallyIncreasingTime() for mac and a fallback implementation that just wraps currentTime(). 9 (WTF::monotonicallyIncreasingTime): 10 * wtf/CurrentTime.h: Add monotonicallyIncreasingTime(). 11 1 12 2011-06-06 Alexandru Chiculita <achicu@adobe.com> 2 13 -
trunk/Source/JavaScriptCore/wtf/CurrentTime.cpp
r79434 r88199 34 34 #include "CurrentTime.h" 35 35 36 #if OS(WINDOWS) 36 #if PLATFORM(MAC) 37 #include <mach/mach_time.h> 38 #include <sys/time.h> 39 #elif OS(WINDOWS) 37 40 38 41 // Windows is first since we want to use hires timers, despite USE(CF) … … 295 298 #endif 296 299 300 #if PLATFORM(MAC) 301 302 double monotonicallyIncreasingTime() 303 { 304 // Based on listing #2 from Apple QA 1398. 305 static mach_timebase_info_data_t timebaseInfo; 306 if (!timebaseInfo.denom) { 307 kern_return_t kr = mach_timebase_info(&timebaseInfo); 308 ASSERT_UNUSED(kr, kr == KERN_SUCCESS); 309 } 310 return (mach_absolute_time() * timebaseInfo.numer) / (1.0e9 * timebaseInfo.denom); 311 } 312 313 #else 314 315 double monotonicallyIncreasingTime() 316 { 317 static double lastTime = 0; 318 double currentTimeNow = currentTime(); 319 if (currentTimeNow < lastTime) 320 return lastTime; 321 lastTime = currentTimeNow; 322 return currentTimeNow; 323 } 324 325 #endif 326 297 327 } // namespace WTF -
trunk/Source/JavaScriptCore/wtf/CurrentTime.h
r77087 r88199 59 59 } 60 60 61 // Provides a monotonically increasing time in seconds since an arbitrary point in the past. 62 // On unsupported platforms, this function only guarantees the result will be non-decreasing. 63 double monotonicallyIncreasingTime(); 64 61 65 } // namespace WTF 62 66 … … 64 68 using WTF::currentTimeMS; 65 69 using WTF::getLocalTime; 70 using WTF::monotonicallyIncreasingTime; 66 71 67 72 #endif // CurrentTime_h 68 -
trunk/Source/WebCore/ChangeLog
r88198 r88199 1 2011-06-06 James Simonsen <simonjam@chromium.org> 2 3 Reviewed by James Robinson. 4 5 Add monotonicallyIncreasingTime() to get monotonically increasing time 6 https://bugs.webkit.org/show_bug.cgi?id=37743 7 8 * platform/chromium/SystemTimeChromium.cpp: 9 (WebCore::monotonicallyIncreasingTime): Add primitive monotonicallyIncreasingTime() which just wraps currentTime(). 10 1 11 2011-06-06 Emil A Eklund <eae@chromium.org> 2 12 -
trunk/Source/WebCore/platform/chromium/SystemTimeChromium.cpp
r76340 r88199 34 34 #include "NotImplemented.h" 35 35 #include "PlatformBridge.h" 36 #include <wtf/CurrentTime.h> 36 37 37 38 namespace WebCore { … … 41 42 { 42 43 return PlatformBridge::currentTime(); 44 } 45 46 double monotonicallyIncreasingTime() 47 { 48 static double lastTime = 0; 49 double currentTimeNow = currentTime(); 50 if (currentTimeNow < lastTime) 51 return lastTime; 52 lastTime = currentTimeNow; 53 return currentTimeNow; 43 54 } 44 55
Note:
See TracChangeset
for help on using the changeset viewer.