[webkit-dev] RFC: stop using std::chrono, go back to using doubles for time
bburg at apple.com
Mon May 23 09:47:35 PDT 2016
+1 to Michael’s point. Naming of variables holding seconds/milliseconds is all over the place.
So, I would favor using Seconds/WallTime/MonotonicTime classes, since they will basically
guarantee that the variable name and/or type will describe the units near use-sites and avoid
Not to belabor Fil’s original argument against std::chrono, but the sheer amount of templates
necessary to express something very simple has scared away myself and plenty of others
from converting code away from doubles. Not to mention, it will trip up anyone reading the
code who hasn’t invested time reading the documentation or doing their own conversion.
Some of the errors Fil mentions, such as overflow, are so obfuscated by the type gymnastics
that the easy-to-understand class of bugs std::chrono eliminates are replaced with more
subtle and harder to fix overflow errors.
> On May 23, 2016, at 8:04 AM, Michael Catanzaro <mcatanzaro at igalia.com> wrote:
> On Mon, 2016-05-23 at 07:27 -0700, Filip Pizło wrote:
>> You guys are making a convincing case for
> I will add: the convention "double means seconds" is very much not
> obvious. It's OK when we're careful to consistently use "seconds" in
> function and variable names, but in practice, that's not always or even
> usually the case in WebKit code.
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
More information about the webkit-dev