ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Clock

Description

The monotonic clock every deadline and imposed wait in the core is measured on. A wall-clock adjustment must never read as a longer lease or a shorter pause.

Synopsis

Documentation

newtype MonoTime Source #

A reading of the monotonic clock, in seconds from an arbitrary origin.

Constructors

MonoTime Double 

Instances

Instances details
Show MonoTime Source # 
Instance details

Defined in Ecluse.Core.Clock

Eq MonoTime Source # 
Instance details

Defined in Ecluse.Core.Clock

Ord MonoTime Source # 
Instance details

Defined in Ecluse.Core.Clock

monotonicNow :: IO MonoTime Source #

Read the monotonic clock.

monoAfter :: MonoTime -> Double -> MonoTime Source #

The instant this many seconds after the given one. A negative offset reads backwards.

monoSecondsBetween :: MonoTime -> MonoTime -> Double Source #

The seconds from the first instant to the second, negative once the second has passed.

waitUntilMonotonic :: MonoTime -> IO () Source #

Wait until the given instant. The clock is re-read, so a wait can only ever come up short.

waitSeconds :: NominalDiffTime -> IO () Source #

Wait a duration, keeping its sub-second part. The microseconds saturate rather than wrap, so an absurd duration waits a very long time instead of returning at once.

secondsToMicros :: NominalDiffTime -> Int Source #

A delay in seconds as the microseconds a delay primitive takes. Every config decoder that spells a pause bounds it below maxBound div 1_000_000, so the conversion cannot wrap.