thyme-0.2.4.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.

Convert between time intervals and Rationals with seconds, or more generally between any Real or Fractional using fromSeconds and toSeconds. If you must convert between DiffTime and NominalDiffTime, compose microDiffTime and microNominalDiffTime.

UTCTime is an instance of AffineSpace, with Diff UTCTimeNominalDiffTime.

Synopsis

Universal Time

Absolute intervals

UTC

Time interval conversion

seconds :: (HasBasis s, Basis s ~ (), HasBasis t, Basis t ~ ()) => Iso s t (Scalar s) (Scalar t)Source

Time interval as a Rational number of seconds. Compose with simple or simply view / review to avoid ambiguous type variables.

toSeconds :: (TimeDiff s, Real (Scalar s), Fractional n) => s -> nSource

Convert a time interval to some Fractional type.

 toSeconds :: (HasBasis s, Basis s ~ (), Scalar s ~ a, Real a, Fractional n) => s -> n

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

Make a time interval from some Real type. Rational-avoiding rewrite rules included for Double, Float, Integer, Int and Int64.

 fromSeconds :: (HasBasis t, Basis t ~ (), Scalar t ~ b, Real n, Fractional b) => n -> t

toSeconds' :: (HasBasis s, Basis s ~ ()) => s -> Scalar sSource

Type-restricted toSeconds to avoid constraint-defaulting warnings.

fromSeconds' :: (HasBasis t, Basis t ~ ()) => Scalar t -> tSource

Type-restricted fromSeconds to avoid constraint-defaulting warnings.

Lenses