Time Unit Conversions
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.
toTimeSpec, fromTimeSpec
Instances
TimeUnit TimeSpec Source # | |
Defined in Streamly.Internal.Data.Time.Units toTimeSpec :: TimeSpec -> TimeSpec fromTimeSpec :: TimeSpec -> TimeSpec | |
TimeUnit MicroSecond64 Source # | |
Defined in Streamly.Internal.Data.Time.Units toTimeSpec :: MicroSecond64 -> TimeSpec | |
TimeUnit MilliSecond64 Source # | |
Defined in Streamly.Internal.Data.Time.Units toTimeSpec :: MilliSecond64 -> TimeSpec | |
TimeUnit NanoSecond64 Source # | |
Defined in Streamly.Internal.Data.Time.Units toTimeSpec :: NanoSecond64 -> TimeSpec fromTimeSpec :: TimeSpec -> NanoSecond64 |
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.
toNanoSecond64, fromNanoSecond64
Instances
Time Units
Data type to represent practically large quantities of time efficiently. It can represent time up to ~292 billion years at nanosecond resolution.
Instances
newtype NanoSecond64 Source #
An Int64
time representation with a nanosecond resolution. It can
represent time up to ~292 years.
Instances
newtype MicroSecond64 Source #
An Int64
time representation with a microsecond resolution.
It can represent time up to ~292,000 years.
Instances
newtype MilliSecond64 Source #
An Int64
time representation with a millisecond resolution.
It can represent time up to ~292 million years.
Instances
showNanoSecond64 :: NanoSecond64 -> String Source #
Convert nanoseconds to a string showing time in an appropriate unit.
Absolute times (using TimeSpec)
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.
Instances
Show AbsTime Source # | |
Eq AbsTime Source # | |
Ord AbsTime Source # | |
Defined in Streamly.Internal.Data.Time.Units |
Relative times (using TimeSpec)
Instances
Num RelTime Source # | |
Defined in Streamly.Internal.Data.Time.Units | |
Read RelTime Source # | |
Show RelTime Source # | |
Eq RelTime Source # | |
Ord RelTime Source # | |
Defined in Streamly.Internal.Data.Time.Units |
fromRelTime :: TimeUnit a => RelTime -> a Source #
Relative times (using NanoSecond64)
Relative times are relative to some arbitrary point of time. Unlike
AbsTime
they are not relative to a predefined epoch.
Instances
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.
showRelTime64 :: RelTime64 -> String Source #