| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
FRP.Rhine.Clock.Realtime.Millisecond
Synopsis
- type Millisecond (n :: Nat) = RescaledClockS IO (Step n) UTCTime Bool
- sleepClock :: KnownNat n => Millisecond n
- waitClock :: KnownNat n => Millisecond n
Documentation
type Millisecond (n :: Nat) = RescaledClockS IO (Step n) UTCTime Bool #
A clock ticking every n milliseconds,
in real time.
Since n is in the type signature,
it is ensured that when composing two signals on a Millisecond clock,
they will be driven at the same rate.
The tag of this clock is Bool,
where True represents successful realtime,
and False a lag.
sleepClock :: KnownNat n => Millisecond n #
This clock simply sleeps n milliseconds after each tick.
The current time is measured, but no adjustment is made.
Consequently, the tag is constantly False,
since the clock will accumulate the computation time as lag.
waitClock :: KnownNat n => Millisecond n #
A more sophisticated implementation that measures the time after each tick,
and waits for the remaining time until the next tick.
If the next tick should already have occurred,
the tag is set to False, representing a failed real time attempt.