Add literals for various time units
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Nov 2016 23:21:39 +0000 (23:21 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Nov 2016 23:21:39 +0000 (23:21 +0000)
commit7bf9a9c2aa7e87dcd132fe7abdd7121ae3820871
treec64b88ce3488f7f53a20020d72527c4e612b36aa
parent0d2372da87ff48114d74a7a412be4c70639d18fa
Add literals for various time units
https://bugs.webkit.org/show_bug.cgi?id=165074

Reviewed by Filip Pizlo.

Source/WTF:

Add _min, _s, _ms, _us and _ns literals for easy creation of Seconds from long double
and unsigned long long types (those allowed for custom literals).

Add minutes-related functions (there are one or two use cases in WebCore).

* wtf/Seconds.h:
(WTF::Seconds::minutes):
(WTF::Seconds::fromMinutes):
(WTF::Seconds::fromMilliseconds):
(WTF::Seconds::fromMicroseconds):
(WTF::Seconds::fromNanoseconds):
(WTF::operator _min):
(WTF::operator _s):
(WTF::operator _ms):
(WTF::operator _us):
(WTF::operator _ns):

Tools:

Add tests for new time literals. Add new tests for units.

* TestWebKitAPI/Tests/WTF/Time.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Seconds.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Time.cpp