Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Control.Concurrent.AlarmClock.TimeScale
Description
Abstraction that allows for a choice of timescale when setting alarms. Exposed in a separate module so it can be faked for testing purposes, but client applications should just import Control.Concurrent.AlarmClock.
Synopsis
- class Eq t => TimeScale t where
- getAbsoluteTime :: IO t
- microsecondsDiff :: t -> t -> Integer
- earlierOf :: t -> t -> t
- newtype MonotonicTime = MonotonicTime TimeSpec
Documentation
class Eq t => TimeScale t where Source #
Abstraction that allows for a choice between the UTC timescale and a monotonic timescale, which differ in their handling of irregularities such as clock adjustments and leap seconds.
Alarms set using the UTCTime
timescale wait for the system clock to pass the
given time before going off, and account for the clock being adjusted
backwards and for (positive) leap seconds while waiting. If the clock is set
forwards, or a negative leap second occurs, then the alarm may go off later
than expected by an amount that is roughly equal to the adjustment. It is
possible to correct for this by setting the alarm again after the adjustment
has occurred.
The Monotonic
timescale cannot be so adjusted, which may be more suitable for
some applications.
Note that the timeliness of the alarm going off is very much on a "best effort" basis, and there are many environmental factors that could cause the alarm to go off later than expected.
Instances
TimeScale UTCTime Source # | |
TimeScale MonotonicTime Source # | |
Defined in Control.Concurrent.AlarmClock.TimeScale Methods getAbsoluteTime :: IO MonotonicTime Source # microsecondsDiff :: MonotonicTime -> MonotonicTime -> Integer Source # earlierOf :: MonotonicTime -> MonotonicTime -> MonotonicTime Source # |
newtype MonotonicTime Source #
Representation of system monotonic clock.
Constructors
MonotonicTime TimeSpec |