-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Provide duration helper -- -- This is a minimal Haskell library to display duration. -- --
-- let duration = 2 * ms + 3 * oneSecond + 2 * minute + 33*day + 2*year -- humanReadableDuration duration -- -- will return: "2 years 33 days 2 min 3s 2ms" -- getYears duration -- -- will return 2 -- getDays duration -- -- will return 763 -- getMs duration -- -- will return 65923323002 --@package human-readable-duration @version 0.2.0.2 -- | This is a minimal Haskell library to display duration. -- --
-- > let duration = 2 * ms + 3 * oneSecond + 2 * minute + 33*day + 2*year -- > humanReadableDuration duration -- "2 years 33 days 2 min 3s 2ms" -- > getYears duration -- 2 -- > getDays duration -- 763 -- > getMs duration -- 65923323002 -- --module Data.Duration -- | 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 -- -- >>> duration -- 65923323.002000 -- -- >>> humanReadableDuration duration -- "2 years 33 days 2 min 3s 2ms" --humanReadableDuration :: Seconds -> String -- | Wrapper around any Real input, which works for -- DiffTime and NominalDiffTime from the time library, -- or a Double of seconds. -- --
-- >>> import Data.Time.Clock -- -- >>> humanReadableDuration' (secondsToDiffTime 10) -- "10s " --humanReadableDuration' :: Real a => a -> String type Seconds = Micro -- | one millisecond (0.001) -- --
-- >>> ms -- 0.001000 -- -- >>> 1000 * ms -- 1.000000 --ms :: Seconds -- | one second (1) -- --
-- >>> oneSecond / ms -- 1000.000000 -- -- >>> oneSecond -- 1.000000 --oneSecond :: Seconds -- | number of seconds in one minute -- --
-- >>> minute / oneSecond -- 60.000000 -- -- >>> minute / ms -- 60000.000000 --minute :: Seconds -- | number of seconds in one hour -- --
-- >>> hour / minute -- 60.000000 -- -- >>> hour / oneSecond -- 3600.000000 --hour :: Seconds -- | number of seconds in one day -- --
-- >>> day / hour -- 24.000000 -- -- >>> day / oneSecond -- 86400.000000 --day :: Seconds -- | number of seconds in one year -- --
-- >>> year / day -- 365.000000 --year :: Seconds -- | number of milli seconds given a duration in micro seconds -- --
-- >>> getMs 1 -- 1000 -- -- >>> getMs 1.618033 -- 1618 --getMs :: Seconds -> Integer -- | number of seconds given a duration in micro seconds -- --
-- >>> getSeconds 1 -- 1 -- -- >>> getSeconds 1.618033 -- 1 --getSeconds :: Seconds -> Integer -- | number of minutes given a duration in micro seconds -- --
-- >>> getMinutes 60 -- 1 -- -- >>> getMinutes 59 -- 0 --getMinutes :: Seconds -> Integer -- | number of hours given a duration in micro seconds -- --
-- >>> getHours 3600 -- 1 -- -- >>> getHours (60 * minute) -- 1 -- -- >>> getHours (2 * day) -- 48 --getHours :: Seconds -> Integer -- | number of days given a duration in micro seconds -- --
-- >>> getDays (10 * day) -- 10 -- -- >>> getDays (240 * hour) -- 10 --getDays :: Seconds -> Integer -- | number of years given a duration in micro seconds -- --
-- >>> getYears (720 * day) -- 1 -- -- >>> getYears (740 * day) -- 2 --getYears :: Seconds -> Integer -- | Use human-readable-duration if you want to replace "1002012 -- seconds left" by the easier to read: "11 days 14 hours 20 min 12s -- left" -- -- But also if you want to manipulate time duration easily by using -- seconds, minutes, hours and days. Typically if you prefer to write: -- --
-- x + (5 * oneSecond) + (2 * minute) + (1 * day) ---- -- instead of -- --
-- x + 5 * 2*60 * 1*60*60*24 --module Data.Duration.Tutorial