thyme-0.3.0.1: A faster time library

Safe HaskellNone

Data.Thyme.Clock

Contents

Description

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.

Synopsis

Universal Time

Absolute intervals

UTC

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 http://hackage.haskell.org/trac/ghc/ticket/7611?

Methods

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.

Lenses