thyme- A faster time library

Safe HaskellNone




Num, Real, Fractional and RealFrac instances for DiffTime and NominalDiffTime are only available by importing Data.Thyme.Time. In their stead are instances of AdditiveGroup, HasBasis and VectorSpace, with Scalar DiffTimeScalar NominalDiffTimeRational.

Using fromSeconds and toSeconds to convert between TimeDiffs and other numeric types. If you really must coerce between DiffTime and NominalDiffTime, view (microseconds . from microseconds).

UTCTime is an instance of AffineSpace, with Diff UTCTimeNominalDiffTime.

UTCTime is not Y294K-compliant. Please file a bug report on GitHub when this becomes a problem.


Universal Time

Absolute intervals


Time interval conversion

class (HasBasis t, Basis t ~ (), Scalar t ~ Rational) => TimeDiff t whereSource

Time differences, encompassing both DiffTime and NominalDiffTime.

FIXME: still affected by


microseconds :: Iso' t Int64Source

Escape hatch; avoid.

toSeconds :: (TimeDiff t, Fractional n) => t -> nSource

Convert a time difference to some Fractional type.

fromSeconds :: (Real n, TimeDiff t) => n -> tSource

Make a time difference from some Real type.

Where speed is a concern, make sure n is one of Float, Double, Int, Int64 or Integer, for which RULES have been provided.

toSeconds' :: TimeDiff t => t -> RationalSource

Type-restricted toSeconds to avoid constraint-defaulting warnings.

fromSeconds' :: TimeDiff t => Rational -> tSource

Type-restricted fromSeconds to avoid constraint-defaulting warnings.