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

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

# Documentation

class 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

Methods

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

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

Instances

 Source # Methods Source # Methods

newtype MonotonicTime Source #

Representation of system monotonic clock.

Constructors

 MonotonicTime TimeSpec

Instances

 Source # Methods Source # Methods Source # MethodsshowList :: [MonotonicTime] -> ShowS # Source # Methods