[Issue 6725] core.time.dur should accept floating point

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 21 12:29:25 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=6725

--- Comment #13 from Jonathan M Davis <jmdavisProg at gmx.com> ---
(In reply to Vladimir Panteleev from comment #12)
> I'd just like to point out that there are more uses to FP time values than
> literals, such as user input. A template which accepts a string as a
> compile-time parameter solves none of my personal use-cases.

If user input is the issue, a function which took a string which represented
the time as a floating point and parsed it to a Duration would presumably do
the trick while avoiding the floating point errors and without encouraging
using floating point values for time in general. It would work well for user
input (because it would already be a string) while being a royal pain for
anyone who wanted to use floating point values for time directly, because
they'd be forced to convert the floating point value to a string in order to
then use the function to convert it to a Duration.

--


More information about the Digitalmars-d-bugs mailing list