alarmclock- Wake up and perform an action at a certain time.

Safe HaskellSafe



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.



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.

Minimal complete definition

getAbsoluteTime, microsecondsDiff, earlierOf


getAbsoluteTime :: IO t Source #

microsecondsDiff :: t -> t -> Integer Source #

earlierOf :: t -> t -> t Source #