haskell / time

A time library
http://hackage.haskell.org/package/time
Other
118 stars 78 forks source link

Keep Pico unit explicit when converting to and from `DiffTime` #237

Closed VictorCMiraldo closed 1 year ago

VictorCMiraldo commented 1 year ago

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 more consistent.

AshleyYakeley commented 1 year ago

This is wrong. picosecondsToDiffTime 1 should be one picosecond. But with this change, it will be one second.

VictorCMiraldo commented 1 year ago

@AshleyYakeley you're right! Sorry, I was a little too quick submitting this PR and forgot to rename the functions. The change should include a renaming of picosecondsToDiffTime to secondsToDiffTime and vice-versa. This would keep the interface consistent with NominalDiffTime.

If it's something you'd like, I'm happy to still do it.