packstream-bolt-0.1.0.0: PackStream binary serialization format
Safe HaskellNone
LanguageGHC2021

Data.PackStream.Timestamp

Description

Internal module. Not part of the public API.

Synopsis

Documentation

data PSTimestamp Source #

A PackStream timestamp

The representable range is [-292277022657-01-27 08:29:52 UTC .. 292277026596-12-04 15:30:07.999999999 UTC] with nanosecond precision.

mptsFromPosixSeconds :: Int64 -> PSTimestamp Source #

Construct PSTimestamp from amount of integral seconds since Unix epoch

mptsFromPosixSeconds2 :: Int64 -> Word32 -> Maybe PSTimestamp Source #

Construct PSTimestamp from amount of seconds and nanoseconds (must be \( \leq 10^9 \) ) passed since Unix epoch

mptsToPosixSeconds2 :: PSTimestamp -> (Int64, Word32) Source #

Deconstruct PSTimestamp into amount of seconds and nanoseconds passed since Unix epoch

mptsFromPosixNanoseconds :: Integer -> Maybe PSTimestamp Source #

Construct PSTimestamp from total amount of nanoseconds passed since Unix epoch

mptsToPosixNanoseconds :: PSTimestamp -> Integer Source #

Deconstruct PSTimestamp into total amount of nanoseconds passed since Unix epoch

mptsFromUTCTime :: UTCTime -> Maybe PSTimestamp Source #

Convert UTCTime into PSTimestamp

This conversion can fail (i.e. result in Nothing) if either the conversion cannot be performed lossless, either because the range of PSTimestamp was exceeded or because of sub-nanosecond fractions.

See also mptsFromUTCTimeLossy

mptsFromUTCTimeLossy :: UTCTime -> PSTimestamp Source #

Version of mptsFromUTCTime which performs a lossy conversion into PSTimestamp

  • sub-nanosecond precision is silently truncated (in the sense of floor) to nanosecond precision
  • time values exceeding the range of PSTimestamp are clamped to minBound and maxBound respectively