From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WTF/wtf/CurrentTime.h | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'Source/WTF/wtf/CurrentTime.h') diff --git a/Source/WTF/wtf/CurrentTime.h b/Source/WTF/wtf/CurrentTime.h index 78e58017f..74b236f79 100644 --- a/Source/WTF/wtf/CurrentTime.h +++ b/Source/WTF/wtf/CurrentTime.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Apple Inc. All rights reserved. * Copyright (C) 2008 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +32,7 @@ #ifndef CurrentTime_h #define CurrentTime_h +#include #include namespace WTF { @@ -55,19 +56,31 @@ inline double currentTimeMS() // NTP or manual adjustments, so it is better suited for elapsed time measurement. WTF_EXPORT_PRIVATE double monotonicallyIncreasingTime(); -// Returns the current CPU time of the current thread in seconds. +inline double monotonicallyIncreasingTimeMS() +{ + return monotonicallyIncreasingTime() * 1000.0; +} + +// Returns the current CPU time of the current thread. // Precision varies depending on platform but is usually as good or better // than a millisecond. -WTF_EXPORT_PRIVATE double currentCPUTime(); +WTF_EXPORT_PRIVATE std::chrono::microseconds currentCPUTime(); + +WTF_EXPORT_PRIVATE void sleep(double); -// Returns the current CPU time of the current thread in milliseconds. -WTF_EXPORT_PRIVATE double currentCPUTimeMS(); +inline void sleepMS(double value) +{ + sleep(value / 1000.0); +} } // namespace WTF +using WTF::currentCPUTime; using WTF::currentTime; using WTF::currentTimeMS; using WTF::monotonicallyIncreasingTime; -using WTF::currentCPUTime; +using WTF::monotonicallyIncreasingTimeMS; +using WTF::sleep; +using WTF::sleepMS; #endif // CurrentTime_h -- cgit v1.2.1