How to convert `std.datetime.Duration` to seconds of floating point type?

Alex sascha.orlov at gmail.com
Tue Feb 19 16:35:49 UTC 2019


On Tuesday, 19 February 2019 at 16:26:33 UTC, drug wrote:
>
> Well, I understand that using floating point values to 
> represent time internally is a bad idea and I totally agree. 
> But some convenient API to convert Duration to floating point 
> and vice versa would be useful because in mechanics for example 
> you often need to express time in seconds with fractional part. 
> In this regard std::chrono is more expressive (the only one 
> though, in general std.datetime is much more powerful than 
> std::chrono).

If you need a real (double, float) parameter, just use it. 
Transport the units separately...


More information about the Digitalmars-d-learn mailing list