Closed erikd closed 4 years ago
nominalDiffTimeToPico
is no good, because it doesn't tell you how much you'll get for your time.
nominalDiffTimeToSeconds
gives you 1 for each second of time.
I actually can't even use nominalDiffTimeToSeconds
because I am still on time-1.8
. HOwever, reading the name and the type I still have zero idea of what it is actually going to do.
Using the time-1.8
is pretty painful too. I can use diffUTCTime
which returns NominalDiffTime
. However, with 1.8
there does not seem to be any way to create a guaranteed correct NominalDiffTime
from a constant. Of course fromIntegral
is available, but that can't create time differences of less than 1 second.
After spending way more time than I should have to do something that should be incredibly simple, I ended up using fromRational
to get some that was actually correct. The types in the time library prevented some mistakes (by hiding type constructors) but encouraged other mistakes like using fromIntegral
.
nominalDiffTimeToSeconds
returns the amount of seconds in a NominalDiffTime
.
Going the other direction, if you want to create a NominalDiffTime
from a given number of seconds, use secondsToNominalDiffTime
. For example, secondsToNominalDiffTime 0.5
gives you a NominalDiffTime
of 0.5 seconds.
This seems really straightforward to me.
The function secondsToNominalDiffTime
does not exist in time-1.8
which introduced NominalDiffTime
with only a tiny number of useful functions to operate on it.
Just to clarify, you are reporting an issue that you already know has been fixed in the latest version, is that correct?
What do you hope to achieve by this?
I still think nominalDiffTimeToSeconds
is confusing and misleading. I was hoping that would be improved or corrected before regular people like me try to use it.
It gets the number of seconds in a NominalDiffTime
. What else would it be called?
This function:
is incredibly poorly named. It would be better named
nominalDiffTimeToPico
.