[lldb-dev] fate of TimeValue

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Thu Oct 6 17:46:41 PDT 2016

I'd love to move over to chrono. For Utility functions such as those you
propose probably we should consider whether they should go into llvm. Does
llvm currently use anything from chrono or have any chrono support
functions yet?
On Thu, Oct 6, 2016 at 5:39 PM Pavel Labath via lldb-dev <
lldb-dev at lists.llvm.org> wrote:

> Hello all,
> in line with the "deinventing the wheel" movement, I'd like to remove the
> TimeValue class from LLDB. I've done some research on a flight this week,
> and as far as I can tell all functionality can be easily replaced with
> appropriate usage of std::chrono::duration and time_point.
> The only parts that are missing are the ability to convert to/from legacy
> C types (struct timevalue, struct timespec), which can be replaced by
> utility functions.
> Also, I've found one use case particularly cumbersome to write in the c++
> way: writing out a duration as a fractional number of units (e.g.
> milliseconds). So, I'd propose adding the following utility function as
> well (unless someone knows a cleaner way to write this):
> template<typename DurOut, typename DurIn>
> double float_duration(DurIn dur) {
>   return std::chrono::duration_cast<std::chrono::duration<double,
> DurOut::period>>(dur).count();
> }
> Then, you can write float_duration<milliseconds>(dur) to get the duration
> as a fractional number of milliseconds (used in printing time deltas in a
> human readable fashion).
> Any thoughts or objections?
> pl
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20161007/e04c9958/attachment.html>

More information about the lldb-dev mailing list