Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
-
class
MonadMonotonicTime
m =>
MonadTime
m
where
- getCurrentTime :: m UTCTime
-
class
Monad
m =>
MonadMonotonicTime
m
where
- getMonotonicTime :: m Time
- newtype Time = Time DiffTime
- diffTime :: Time -> Time -> DiffTime
- addTime :: DiffTime -> Time -> Time
- data DiffTime
- data UTCTime
- diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime
- addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
- data NominalDiffTime
Documentation
class MonadMonotonicTime m => MonadTime m where Source #
getCurrentTime :: m UTCTime Source #
Wall clock time.
class Monad m => MonadMonotonicTime m where Source #
getMonotonicTime :: m Time Source #
Time in a monotonic clock, with high precision. The epoch for this clock is arbitrary and does not correspond to any wall clock or calendar.
Instances
MonadMonotonicTime IO Source # | |
Defined in Control.Monad.Class.MonadTime |
|
MonadMonotonicTime m => MonadMonotonicTime ( ReaderT r m) Source # | |
Defined in Control.Monad.Class.MonadTime getMonotonicTime :: ReaderT r m Time Source # |
DiffTime
and its action on
Time
A point in time in a monotonic clock.
The epoch for this clock is arbitrary and does not correspond to any wall
clock or calendar, and is
not guaranteed
to be the same epoch across
program runs. It is represented as the
DiffTime
from this arbitrary epoch.
diffTime :: Time -> Time -> DiffTime Source #
The time duration between two points in time (positive or negative).
addTime :: DiffTime -> Time -> Time infixr 9 Source #
Add a duration to a point in time, giving another time.
This is a length of time, as measured by a clock. Conversion functions will treat it as seconds. It has a precision of 10^-12 s.
Instances
NominalTime
and its action on
UTCTime
This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.
Instances
Eq UTCTime | |
Data UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> UTCTime -> c UTCTime Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c UTCTime Source # toConstr :: UTCTime -> Constr Source # dataTypeOf :: UTCTime -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c UTCTime ) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c UTCTime ) Source # gmapT :: ( forall b. Data b => b -> b) -> UTCTime -> UTCTime Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> UTCTime -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> UTCTime -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> UTCTime -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> UTCTime -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source # |
|
Ord UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime |
|
NFData UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime |
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime Source #
diffUTCTime a b = a - b
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime Source #
addUTCTime a b = a + b
data NominalDiffTime Source #
This is a length of time, as measured by UTC. It has a precision of 10^-12 s.
Conversion functions will treat it as seconds.
For example,
(0.010 :: NominalDiffTime)
corresponds to 10 milliseconds.
It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.