HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Time Unit Conversions

classclass TimeUnit a where

A type class for converting between time units using Integer as the intermediate and the widest representation with a nanosecond resolution. This system of units can represent arbitrarily large times but provides least efficient arithmetic operations due to Integer arithmetic.

NOTE: Converting to and from units may truncate the value depending on the original value and the size and resolution of the destination unit.

A type class for converting between units of time using TimeSpec as the intermediate representation. This system of units can represent up to ~292 billion years at nanosecond resolution with reasonably efficient arithmetic operations.

NOTE: Converting to and from units may truncate the value depending on the original value and the size and resolution of the destination unit.

Instances4TimeUnit
classclass TimeUnit64 a where

A type class for converting between units of time using Int64 as the intermediate representation with a nanosecond resolution. This system of units can represent up to ~292 years at nanosecond resolution with fast arithmetic operations.

NOTE: Converting to and from units may truncate the value depending on the original value and the size and resolution of the destination unit.

Instances3TimeUnit64

Time Units

datadata TimeSpec

Data type to represent practically large quantities of time efficiently. It can represent time up to ~292 billion years at nanosecond resolution.

Constructors

Instances7Eq, Num, Ord, Read, Show, Storable, …
  • Eq TimeSpecDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.TimeSpec
  • Num TimeSpecDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.TimeSpec
  • Ord TimeSpecDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.TimeSpec
  • Read TimeSpecDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.TimeSpec
  • Show TimeSpecDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.TimeSpec
  • Storable TimeSpecDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.TimeSpec
  • TimeUnit TimeSpecDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
newtypenewtype NanoSecond64

An Int64 time representation with a nanosecond resolution. It can represent time up to ~292 years.

Constructors

Instances13Bounded, Enum, Eq, Integral, Num, Ord, …
newtypenewtype MicroSecond64

An Int64 time representation with a microsecond resolution. It can represent time up to ~292,000 years.

Constructors

Instances13Bounded, Enum, Eq, Integral, Num, Ord, …
newtypenewtype MilliSecond64

An Int64 time representation with a millisecond resolution. It can represent time up to ~292 million years.

Constructors

Instances13Bounded, Enum, Eq, Integral, Num, Ord, …

Absolute times (using TimeSpec)

newtypenewtype AbsTime

Absolute times are relative to a predefined epoch in time. AbsTime represents times using TimeSpec which can represent times up to ~292 billion years at a nanosecond resolution.

Constructors

Instances3Eq, Ord, Show
  • Eq AbsTimeDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Ord AbsTimeDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Show AbsTimeDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units

Relative times (using TimeSpec)

newtypenewtype RelTime
#
Instances5Eq, Num, Ord, Read, Show
  • Eq RelTimeDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Num RelTimeDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Ord RelTimeDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Read RelTimeDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Show RelTimeDefined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units

Relative times (using NanoSecond64)

newtypenewtype RelTime64

Relative times are relative to some arbitrary point of time. Unlike AbsTime they are not relative to a predefined epoch.

Instances9Bounded, Enum, Eq, Integral, Num, Ord, …
  • Bounded RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Enum RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Eq RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Integral RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Num RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Ord RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Read RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Real RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units
  • Show RelTime64Defined in streamly-core-0.3.1 · Streamly.Internal.Data.Time.Units