DiffTime package:thyme

An interval or duration of time, as would be measured by a stopwatch. DiffTime is an instance of AdditiveGroup as well as VectorSpace, with Rational as its Scalar. We do not provide Num, Real, Fractional nor RealFrac instances here. See Data.Thyme.Docs#spaces for details.
> fromSeconds' 100 :: DiffTime
100s
> fromSeconds' 100 ^+^ fromSeconds' 100 ^* 4
500s
> fromSeconds' 100 ^-^ fromSeconds' 100 ^/ 4
75s
The nominal interval between two UTCTimes, which does not take leap seconds into account. For example, the difference between 23:59:59 and 00:00:01 on the following day is always 2 seconds of NominalDiffTime, regardless of whether a leap-second took place. NominalDiffTime is an instance of AdditiveGroup as well as VectorSpace, with Rational as its Scalar. We do not provide Num, Real, Fractional nor RealFrac instances here. See Data.Thyme.Docs#spaces for details.
> let d = fromSeconds' 2 :: NominalDiffTime
> d
2s
> d ^/ 3
0.666667s
See also: UTCTime.
Construct a DiffTime from some number of picoseconds. The input will be rounded to the nearest microsecond.
picosecondsToDiffTime a = microseconds # quot (a + signum a * 500000) 1000000
Construct a DiffTime from some number of seconds. This is just fromSeconds with a more constrained type.
secondsToDiffTime = fromSeconds