hodatime
Copyright(C) 2016 Jason Johnson
LicenseBSD-style (see the file LICENSE)
MaintainerJason Johnson <jason.johnson.081@gmail.com>
Stabilityexperimental
PortabilityPOSIX, Windows
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.HodaTime.Duration

Description

A Duration is fixed period of time between global times.

Cookbook

Ninety minutes from now

import Data.HodaTime.Instant (Instant, now, add)
import Data.HodaTime.Duration (fromMinutes)

ninetyMinutesFromNow :: IO Instant
ninetyMinutesFromNow = do
  t <- now
  return (t `add` fromMinutes 90)
Synopsis

Types

data Duration Source #

Represents a duration of time between instants. It can be from days to nanoseconds, but anything longer is not representable by a duration because e.g. Months are calendar specific concepts.

Instances

Instances details
Show Duration Source # 
Instance details

Defined in Data.HodaTime.Instant.Internal

NFData Duration Source # 
Instance details

Defined in Data.HodaTime.Instant.Internal

Methods

rnf :: Duration -> () #

Eq Duration Source # 
Instance details

Defined in Data.HodaTime.Instant.Internal

Ord Duration Source # 
Instance details

Defined in Data.HodaTime.Instant.Internal

Hashable Duration Source # 
Instance details

Defined in Data.HodaTime.Instant.Internal

Methods

hashWithSalt :: Int -> Duration -> Int #

hash :: Duration -> Int #

Constructors

fromStandardWeeks :: Int -> Duration Source #

Duration of standard weeks (a standard week is assumed to be exactly 7 24 hour days)

fromStandardDays :: Int -> Duration Source #

Duration of standard days (a standard day is assumed to be exactly 24 hours)

fromHours :: Int -> Duration Source #

Duration of hours

fromMinutes :: Int -> Duration Source #

Duration of minutes

fromSeconds :: Int -> Duration Source #

Duration of seconds

fromMilliseconds :: Int -> Duration Source #

Duration of milliseconds

fromMicroseconds :: Int -> Duration Source #

Duration of microseconds

fromNanoseconds :: Int -> Duration Source #

Duration of nanoseconds

Math

add :: Duration -> Duration -> Duration Source #

Add two durations together

minus :: Duration -> Duration -> Duration Source #

Subtract one duration from the other