Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Monad m => MonadTime (m :: Type -> Type) where
- getCurrentTime :: m UTCTime
- class MonadMonotonicTimeNSec m => MonadMonotonicTime (m :: Type -> Type) 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 Monad m => MonadTime (m :: Type -> Type) where #
getCurrentTime :: m UTCTime #
Wall clock time.
Instances
MonadTime IO | |
Defined in Control.Monad.Class.MonadTime getCurrentTime :: IO UTCTime # | |
MonadTime m => MonadTime (ReaderT r m) | |
Defined in Control.Monad.Class.MonadTime getCurrentTime :: ReaderT r m UTCTime # |
class MonadMonotonicTimeNSec m => MonadMonotonicTime (m :: Type -> Type) where Source #
Nothing
getMonotonicTime :: m Time Source #
default getMonotonicTime :: m Time Source #
Instances
MonadMonotonicTime IO Source # | |
Defined in Control.Monad.Class.MonadTime.SI | |
MonadMonotonicTime m => MonadMonotonicTime (ReaderT r m) Source # | |
Defined in Control.Monad.Class.MonadTime.SI 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.
Instances
NFData Time Source # | |||||
Defined in Control.Monad.Class.MonadTime.SI | |||||
Generic Time Source # | |||||
Defined in Control.Monad.Class.MonadTime.SI
| |||||
Show Time Source # | |||||
Eq Time Source # | |||||
Ord Time Source # | |||||
NoThunks Time Source # | |||||
type Rep Time Source # | |||||
Defined in Control.Monad.Class.MonadTime.SI |
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 such as fromInteger
and realToFrac
will treat it as seconds.
For example, (0.010 :: DiffTime)
corresponds to 10 milliseconds.
It has a precision of one picosecond (= 10^-12 s). Enumeration functions will treat it as picoseconds.
Instances
NFData DiffTime | |
Defined in Data.Time.Clock.Internal.DiffTime | |
Data DiffTime | |
Defined in Data.Time.Clock.Internal.DiffTime gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DiffTime -> c DiffTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DiffTime # toConstr :: DiffTime -> Constr # dataTypeOf :: DiffTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DiffTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DiffTime) # gmapT :: (forall b. Data b => b -> b) -> DiffTime -> DiffTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DiffTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DiffTime -> r # gmapQ :: (forall d. Data d => d -> u) -> DiffTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DiffTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime # | |
Enum DiffTime | |
Defined in Data.Time.Clock.Internal.DiffTime | |
Num DiffTime | |
Read DiffTime | |
Fractional DiffTime | |
Real DiffTime | |
Defined in Data.Time.Clock.Internal.DiffTime toRational :: DiffTime -> Rational # | |
RealFrac DiffTime | |
Show DiffTime | |
Eq DiffTime | |
Ord DiffTime | |
Defined in Data.Time.Clock.Internal.DiffTime | |
NoThunks DiffTime | |
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
NFData UTCTime | |
Defined in Data.Time.Clock.Internal.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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime # toConstr :: UTCTime -> Constr # dataTypeOf :: UTCTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) # gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # | |
Eq UTCTime | |
Ord UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
NoThunks UTCTime | |
ISO8601 UTCTime |
|
Defined in Data.Time.Format.ISO8601 |
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime #
diffUTCTime a b = a - b
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime #
addUTCTime a b = a + b
data NominalDiffTime #
This is a length of time, as measured by UTC. It has a precision of 10^-12 s.
Conversion functions such as fromInteger
and realToFrac
will treat it as seconds.
For example, (0.010 :: NominalDiffTime)
corresponds to 10 milliseconds.
It has a precision of one picosecond (= 10^-12 s). Enumeration functions will treat it as picoseconds.
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.