human-readable-duration-0.2.0.0: Provide duration helper

Safe HaskellSafe
LanguageHaskell2010

Data.Duration

Synopsis

Documentation

humanReadableDuration :: Micro -> String Source

humanReadableDuration take some time in micro-second precision and render a human readable duration.

let duration = 2 * ms + 3 * oneSecond + 2 * minute + 33*day + 2*year
humanReadableDuration duration
-- will return: "2 years 33 days 2 min 3s 32ms"

humanReadableDuration' :: Real a => a -> String Source

Wrapper around any Real input, which works for DiffTime and NominalDiffTime from the time library, or a Double of seconds.

ms :: Micro Source

 number of micro seconds in one millisecond

oneSecond :: Micro Source

 number of micro seconds in one second

minute :: Micro Source

 number of micro seconds in one minute

hour :: Micro Source

 number of micro seconds in one hour

day :: Micro Source

 number of micro seconds in one day

year :: Micro Source

 number of micro seconds in one year

getMs :: Micro -> Integer Source

 number of milli seconds given a duration in micro seconds

getSeconds :: Micro -> Integer Source

 number of seconds given a duration in micro seconds

getMinutes :: Micro -> Integer Source

 number of minutes given a duration in micro seconds

getHours :: Micro -> Integer Source

 number of hours given a duration in micro seconds

getDays :: Micro -> Integer Source

 number of days given a duration in micro seconds

getYears :: Micro -> Integer Source

 number of years given a duration in micro seconds