human-readable-duration-0.1.0.0: Provide duration helper

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Duration

Synopsis

Documentation

humanReadableDuration :: Int -> String Source

humanReadableDuration take some time in micro-seconds 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"

ms :: Int Source

 number of micro seconds in one millisecond

oneSecond :: Int Source

 number of micro seconds in one second

minute :: Int Source

 number of micro seconds in one minute

hour :: Int Source

 number of micro seconds in one hour

day :: Int Source

 number of micro seconds in one day

year :: Int Source

 number of micro seconds in one year

getMs :: Int -> Int Source

 number of milli seconds given a duration in micro seconds

getSeconds :: Int -> Int Source

 number of seconds given a duration in micro seconds

getMinutes :: Int -> Int Source

 number of minutes given a duration in micro seconds

getHours :: Int -> Int Source

 number of hours given a duration in micro seconds

getDays :: Int -> Int Source

 number of days given a duration in micro seconds

getYears :: Int -> Int Source

 number of years given a duration in micro seconds