streamly-core-0.2.2: Streaming, parsers, arrays, serialization and more
Copyright(c) 2019 Composewell Technologies
LicenseBSD3
Maintainerstreamly@composewell.com
Stabilitypre-release
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Data.Time.Units

Description

 
Synopsis

Time Unit Conversions

class TimeUnit a Source #

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.

Minimal complete definition

toTimeSpec, fromTimeSpec

class TimeUnit64 a Source #

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.

Minimal complete definition

toNanoSecond64, fromNanoSecond64

Time Units

data TimeSpec Source #

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

Constructors

TimeSpec 

Fields

Instances

Instances details
Storable TimeSpec Source # 
Instance details

Defined in Streamly.Internal.Data.Time.TimeSpec

Num TimeSpec Source # 
Instance details

Defined in Streamly.Internal.Data.Time.TimeSpec

Read TimeSpec Source # 
Instance details

Defined in Streamly.Internal.Data.Time.TimeSpec

Show TimeSpec Source # 
Instance details

Defined in Streamly.Internal.Data.Time.TimeSpec

Eq TimeSpec Source # 
Instance details

Defined in Streamly.Internal.Data.Time.TimeSpec

Ord TimeSpec Source # 
Instance details

Defined in Streamly.Internal.Data.Time.TimeSpec

TimeUnit TimeSpec Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

newtype NanoSecond64 Source #

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

Constructors

NanoSecond64 Int64 

Instances

Instances details
Storable NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Bounded NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Enum NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Num NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Read NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Integral NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Real NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Show NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Eq NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Ord NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

TimeUnit NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

TimeUnit64 NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Unbox NanoSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

newtype MicroSecond64 Source #

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

Constructors

MicroSecond64 Int64 

Instances

Instances details
Storable MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Bounded MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Enum MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Num MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Read MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Integral MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Real MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Show MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Eq MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Ord MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

TimeUnit MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

TimeUnit64 MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Unbox MicroSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

newtype MilliSecond64 Source #

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

Constructors

MilliSecond64 Int64 

Instances

Instances details
Storable MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Bounded MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Enum MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Num MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Read MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Integral MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Real MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Show MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Eq MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Ord MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

TimeUnit MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

TimeUnit64 MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Unbox MilliSecond64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

showNanoSecond64 :: NanoSecond64 -> String Source #

Convert nanoseconds to a string showing time in an appropriate unit.

Absolute times (using TimeSpec)

newtype AbsTime Source #

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

AbsTime TimeSpec 

toAbsTime :: TimeUnit a => a -> AbsTime Source #

Convert a TimeUnit to an absolute time.

fromAbsTime :: TimeUnit a => AbsTime -> a Source #

Convert absolute time to a TimeUnit.

Relative times (using TimeSpec)

Relative times (using NanoSecond64)

data RelTime64 Source #

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

Instances

Instances details
Bounded RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Enum RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Num RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Read RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Integral RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Real RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Show RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Eq RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

Ord RelTime64 Source # 
Instance details

Defined in Streamly.Internal.Data.Time.Units

toRelTime64 :: TimeUnit64 a => a -> RelTime64 Source #

Convert a TimeUnit to a relative time.

fromRelTime64 :: TimeUnit64 a => RelTime64 -> a Source #

Convert relative time to a TimeUnit.

diffAbsTime64 :: AbsTime -> AbsTime -> RelTime64 Source #

Difference between two absolute points of time.