hydra-tx-0.19.0: Hydra transaction library
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Ledger.Cardano.Time

Description

Module containing time conversion functions. These functions are assuming that there is never going to be a different slot or epoch length and project a slot/time accordingly.

See Hydra.Chain.Direct.TimeHandle for an alternative that uses the cardano-node provided EraSummary to do "correct" translation on time.

Synopsis

Documentation

slotNoToUTCTime :: SystemStart -> SlotLength -> SlotNo -> UTCTime Source #

Convert a SlotNo to a UTCTime using given SystemStart and SlotLength. This assumes the slot length never changes!

slotNoFromUTCTime :: SystemStart -> SlotLength -> UTCTime -> SlotNo Source #

Convert a UTCTime to a SlotNo using given SystemStart and SlotLength. This assumes the slot length never changes! Also if the UTCTime is before the systemStart it will truncate to slot 0.