Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data SlotConfig = SlotConfig {
- scSlotLength :: !Integer
- scSlotZeroTime :: !POSIXTime
- data SlotConversionError = SlotOutOfRange {
- requestedSlot :: !Slot
- horizon :: !(Slot, POSIXTime)
- slotRangeToPOSIXTimeRange :: SlotConfig -> SlotRange -> POSIXTimeRange
- slotToPOSIXTimeRange :: SlotConfig -> Slot -> POSIXTimeRange
- slotToBeginPOSIXTime :: SlotConfig -> Slot -> POSIXTime
- slotToEndPOSIXTime :: SlotConfig -> Slot -> POSIXTime
- posixTimeRangeToContainedSlotRange :: SlotConfig -> POSIXTimeRange -> SlotRange
- posixTimeToEnclosingSlot :: SlotConfig -> POSIXTime -> Slot
- currentSlot :: SlotConfig -> IO Slot
- utcTimeToPOSIXTime :: UTCTime -> POSIXTime
- posixTimeToUTCTime :: POSIXTime -> UTCTime
- nominalDiffTimeToPOSIXTime :: NominalDiffTime -> POSIXTime
- posixTimeToNominalDiffTime :: POSIXTime -> NominalDiffTime
Documentation
data SlotConfig Source #
Datatype to configure the length (ms) of one slot and the beginning of the first slot.
SlotConfig | |
|
Instances
data SlotConversionError Source #
SlotOutOfRange | |
|
Instances
slotRangeToPOSIXTimeRange :: SlotConfig -> SlotRange -> POSIXTimeRange Source #
Convert a SlotRange
to a POSIXTimeRange
given a SlotConfig
. The
resulting POSIXTimeRange
refers to the starting time of the lower bound of
the SlotRange
and the ending time of the upper bound of the SlotRange
.
slotToPOSIXTimeRange :: SlotConfig -> Slot -> POSIXTimeRange Source #
Convert a Slot
to a POSIXTimeRange
given a SlotConfig
. Each Slot
can be represented by an interval of time.
slotToBeginPOSIXTime :: SlotConfig -> Slot -> POSIXTime Source #
Get the starting POSIXTime
of a Slot
given a SlotConfig
.
slotToEndPOSIXTime :: SlotConfig -> Slot -> POSIXTime Source #
Get the ending POSIXTime
of a Slot
given a SlotConfig
.
posixTimeRangeToContainedSlotRange :: SlotConfig -> POSIXTimeRange -> SlotRange Source #
Convert a POSIXTimeRange
to SlotRange
given a SlotConfig
. This gives
the biggest slot range that is entirely contained by the given time range.
posixTimeToEnclosingSlot :: SlotConfig -> POSIXTime -> Slot Source #
Convert a POSIXTime
to Slot
given a SlotConfig
.
currentSlot :: SlotConfig -> IO Slot Source #
Get the current slot number
utcTimeToPOSIXTime :: UTCTime -> POSIXTime Source #
posixTimeToUTCTime :: POSIXTime -> UTCTime Source #
nominalDiffTimeToPOSIXTime :: NominalDiffTime -> POSIXTime Source #
posixTimeToNominalDiffTime :: POSIXTime -> NominalDiffTime Source #