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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 23 12:00:14 PDT 2014


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

Sobirari Muhomori <dfj1esp02 at sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #32 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> ---
(In reply to Vladimir Panteleev from comment #26)
> (In reply to Sobirari Muhomori from comment #25)
> > That's an overengineered interface and should be done in your code.
> > Fractions of timeouts are practically indiscernible, nobody would need to
> > specify it that way.
> 
> Huh? That's pretty much the standard way to specify timeouts in many
> utilities (sleep, timeout, top...). I don't understand your argument - are
> you saying that no one should ever need to write a shell script that sleeps
> for less than 1 second?

It's meaningful to sleep for 200ms, but not for 0.2s. When you need a better
precision, you switch to the appropriate unit. How would you specify 1/60
fraction of a minute?

> (In reply to Sobirari Muhomori from comment #25)
> > The examples presented are quite esoteric
> 
> IMHO the counter-examples presented here are the esoteric ones. Consider:
> 
> - hashing of time values

Digital signature is an important example. Cryptographic security is an
important technology enjoying wide use.

> vs.
> 
> - allowing the user to specify a fractional number of seconds to sleep for

Millisecond exists precisely for that purpose. In my experience millisecond
precision works fine up to a scale of a minute (even though you don't need
milliseconds for durations >2s).

> - tweaking a literal in your code to sleep for 1.5 seconds instead of 1

It's again a need for a precision better than a second. Though, I'd still
question that 1.5s is much better than 1 or 2 seconds.

(In reply to Steven Schveighoffer from comment #27)
> That has nothing to do with allowing specification of durations via floating
> point.

I replied to the statement that there's no problem with floats in time
arithmetic. I'd say, it should be discouraged.

> > The examples presented are quite esoteric and don't prove necessity of
> > having floatDur in standard library. Though, floatDur can be included in
> > docs to help people copy it if they really need it.
> 
> I agree with Vladimir. Specifying 1.5 or 1.2 seconds to sleep is not
> esoteric or even uncommon. Depending on exact hashing of timestamps across
> many different platforms is.

The requirement arises from the fact that the signature is generated and
checked on client, and clients are diverse in software and hardware. I
presented a real range of technologies of our clients. Well, maybe I can
withdraw the c++ requirement.

BTW, the resolution was wontfix.

--


More information about the Digitalmars-d-bugs mailing list