| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- newtype MonoTime = MonoTime Double
- monotonicNow :: IO MonoTime
- monoAfter :: MonoTime -> Double -> MonoTime
- monoSecondsBetween :: MonoTime -> MonoTime -> Double
- waitUntilMonotonic :: MonoTime -> IO ()
- waitSeconds :: NominalDiffTime -> IO ()
- secondsToMicros :: NominalDiffTime -> Int
Documentation
A reading of the monotonic clock, in seconds from an arbitrary origin.
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 , so the conversion cannot wrap.div 1_000_000