temporal-sdk
Safe HaskellNone
LanguageHaskell2010

Temporal.Duration

Description

Convenient units of time for use with timers and timeouts.

Anything longer than a week (Months, Years) becomes ambiguous because they are variable length. For example, a month can be 28, 29, 30, or 31 days.

If you need to represent a duration as years or months, you may want to use the time library to normalize against a specific time zone and then convert the difference between now and then into a Duration.

Alternatively, consider using Temporal's scheduling features to schedule a workflow to run at one or more specific times in the future.

Synopsis

Documentation

data Duration Source #

A duration of time. Durations are always positive.

Instances

Instances details
FromJSON Duration Source # 
Instance details

Defined in Temporal.Duration

ToJSON Duration Source #

Generated output always contains 0, 3, 6, or 9 fractional digits, depending on required precision, followed by the suffix "s". Accepted are any fractional digits (also none) as long as they fit into nano-seconds precision and the suffix "s" is required.

Instance details

Defined in Temporal.Duration

Monoid Duration Source # 
Instance details

Defined in Temporal.Duration

Semigroup Duration Source # 
Instance details

Defined in Temporal.Duration

Data Duration Source # 
Instance details

Defined in Temporal.Duration

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Duration -> c Duration #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Duration #

toConstr :: Duration -> Constr #

dataTypeOf :: Duration -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Duration) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Duration) #

gmapT :: (forall b. Data b => b -> b) -> Duration -> Duration #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Duration -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Duration -> r #

gmapQ :: (forall d. Data d => d -> u) -> Duration -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Duration -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Duration -> m Duration #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Duration -> m Duration #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Duration -> m Duration #

Show Duration Source # 
Instance details

Defined in Temporal.Duration

Eq Duration Source # 
Instance details

Defined in Temporal.Duration

Ord Duration Source # 
Instance details

Defined in Temporal.Duration

Lift Duration Source # 
Instance details

Defined in Temporal.Duration

Methods

lift :: Quote m => Duration -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => Duration -> Code m Duration #

addDurations :: Duration -> Duration -> Duration Source #

Add two durations together. Durations are subject to integer overflow.

diffTimeToDuration :: DiffTime -> Duration Source #

Convert a DiffTime to a Duration.

N.B. negative DiffTime values will be clamped to 0 (i.e. Duration will be 0) in order to avoid the conversion of negative DiffTime values to extremely large Word64 values.

nominalDiffTimeToDuration :: NominalDiffTime -> Duration Source #

Convert a NominalDiffTime to a Duration.

N.B. negative NominalDiffTime values will be clamped to 0 (i.e. Duration will be 0) in order to avoid the conversion of negative NominalDiffTime values to extremely large Word64 values.

nanoseconds :: Integer -> Duration Source #

Create a Duration from a given number of nanoseconds.

microseconds :: Integer -> Duration Source #

Create a Duration from a given number of microseconds.

milliseconds :: Int64 -> Duration Source #

Create a Duration from a given number of milliseconds.

seconds :: Int64 -> Duration Source #

Create a Duration from a given number of seconds.

minutes :: Int32 -> Duration Source #

Create a Duration from a given number of minutes.

hours :: Int32 -> Duration Source #

Create a Duration from a given number of hours.

days :: Int32 -> Duration Source #

Create a Duration from a given number of days.

weeks :: Int32 -> Duration Source #

Create a Duration from a given number of weeks.

infinity :: Duration Source #

A Duration representing the maximum possible length of time. (Approximately 132 years.)

durationFromProto :: Duration -> Duration Source #

Convert a protocol buffer duration to a Duration.

durationToProto :: Duration -> Duration Source #

Convert a Duration to a protocol buffer duration.

durationToMilliseconds :: Duration -> Double Source #

Convert a Duration to a milliseconds represented as a Double. This is mostly useful for human-readable values emitted by logs, metrics, traces, etc.