time
time copied to clipboard
Keep Pico unit explicit when converting to and from DiffTime
(Re-submitting a patched #237, inlining the description for convenience)
The conversion of picoseconds to and from DiffTime
doesn't keep the unit explicit. Which can be confusing and is not homogeneous with the same conversion, but to and from NominalDiffTime
. This is a very simple PR to make the API a little more consistent.
@AshleyYakeley, if this is still not correct, please let me know, I'm happy to fix it :)
No reason to get rid of picosecondsToDiffTime
, diffTimeToPicoseconds
, is there?
The reason was to homogenize the interface of DiffTime
and NominalDiffTime
, providing the same functions with similar names.
That being said, if we rather not remove somethint but still want a homogeneous API, we could instead add nominalDiffTimeToPicoseconds
and picosecondsToNominalDiffTime
.
What do you think?
So this is a breaking change in any case and I would prefer to break as little as possible. The whole point of picoseconds is that is the underlying Integer type, that, for example, the Enum
instance is based on.
That's fair! I'll bring them back later today or tomorrow!