-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A basic library for defining units of time as types.
--   
--   In many cases, it is useful (either for error checking or
--   documentation reasons) to define input and output types as having a
--   particular unit of time. In addition, by creating a type class
--   defining type units, this library should make it easier to separate
--   the units of time the developer wants to think in versus the units of
--   time the library author wants to think in.
@package time-units
@version 1.0.0


-- | This module defines types for many useful time periods, as well as
--   mechanisms for converting between them.
module Data.Time.Units

-- | A generic class that describes all the units of time. We use
--   microseconds here because that tends to be what GHC (at least) tends
--   to use as its system-level minimum tick size.
class TimeUnit a

-- | Converts the given unit of time into microseconds, flooring the value
--   if it comes to a fractional number of microseconds. (In other words:
--   be careful, you may lose precision!)
toMicroseconds :: TimeUnit a => a -> Integer

-- | Converts the given number of microseconds into the unit of time,
--   flooring the value if it comes to a fraction number of the given unit.
--   (In other words: be careful, you may lose precision!)
fromMicroseconds :: TimeUnit a => Integer -> a
data Attosecond
data Femtosecond
data Picosecond
data Nanosecond
data Microsecond
data Millisecond
data Second
data Minute
data Hour
data Day
data Week
data Fortnight

-- | Add two times together to get a useful third time unit. As per usual,
--   you'll want to make sure that you are careful regarding precision.
--   This function goes through microseconds as an intermediary form.
addTime :: (TimeUnit a, TimeUnit b, TimeUnit c) => a -> b -> c

-- | Subtract the second time from the first, to get a useful third time
--   unit. As per usual, you'll want to make sure that you are careful
--   regarding precision. This function goes through microseconds as an
--   intermediary form.
subTime :: (TimeUnit a, TimeUnit b, TimeUnit c) => a -> b -> c

-- | Convert one time unit to another. Note that if you move from a smaller
--   time unit to a larger one, or between two time units smaller than a
--   microsecond, you will lose precision.
convertUnit :: (TimeUnit a, TimeUnit b) => a -> b

-- | Get the current CPU time in your favorite units. This is probably not
--   very useful in itself, but is likely useful for comparison purposes
--   ...
getCPUTimeWithUnit :: TimeUnit a => IO a
instance GHC.Ix.Ix Data.Time.Units.Attosecond
instance GHC.Real.Real Data.Time.Units.Attosecond
instance GHC.Classes.Ord Data.Time.Units.Attosecond
instance GHC.Num.Num Data.Time.Units.Attosecond
instance Data.Data.Data Data.Time.Units.Attosecond
instance GHC.Real.Integral Data.Time.Units.Attosecond
instance GHC.Classes.Eq Data.Time.Units.Attosecond
instance GHC.Enum.Enum Data.Time.Units.Attosecond
instance GHC.Ix.Ix Data.Time.Units.Femtosecond
instance GHC.Real.Real Data.Time.Units.Femtosecond
instance GHC.Classes.Ord Data.Time.Units.Femtosecond
instance GHC.Num.Num Data.Time.Units.Femtosecond
instance Data.Data.Data Data.Time.Units.Femtosecond
instance GHC.Real.Integral Data.Time.Units.Femtosecond
instance GHC.Classes.Eq Data.Time.Units.Femtosecond
instance GHC.Enum.Enum Data.Time.Units.Femtosecond
instance GHC.Ix.Ix Data.Time.Units.Picosecond
instance GHC.Real.Real Data.Time.Units.Picosecond
instance GHC.Classes.Ord Data.Time.Units.Picosecond
instance GHC.Num.Num Data.Time.Units.Picosecond
instance Data.Data.Data Data.Time.Units.Picosecond
instance GHC.Real.Integral Data.Time.Units.Picosecond
instance GHC.Classes.Eq Data.Time.Units.Picosecond
instance GHC.Enum.Enum Data.Time.Units.Picosecond
instance GHC.Ix.Ix Data.Time.Units.Nanosecond
instance GHC.Real.Real Data.Time.Units.Nanosecond
instance GHC.Classes.Ord Data.Time.Units.Nanosecond
instance GHC.Num.Num Data.Time.Units.Nanosecond
instance Data.Data.Data Data.Time.Units.Nanosecond
instance GHC.Real.Integral Data.Time.Units.Nanosecond
instance GHC.Classes.Eq Data.Time.Units.Nanosecond
instance GHC.Enum.Enum Data.Time.Units.Nanosecond
instance GHC.Ix.Ix Data.Time.Units.Microsecond
instance GHC.Real.Real Data.Time.Units.Microsecond
instance GHC.Classes.Ord Data.Time.Units.Microsecond
instance GHC.Num.Num Data.Time.Units.Microsecond
instance Data.Data.Data Data.Time.Units.Microsecond
instance GHC.Real.Integral Data.Time.Units.Microsecond
instance GHC.Classes.Eq Data.Time.Units.Microsecond
instance GHC.Enum.Enum Data.Time.Units.Microsecond
instance GHC.Ix.Ix Data.Time.Units.Millisecond
instance GHC.Real.Real Data.Time.Units.Millisecond
instance GHC.Classes.Ord Data.Time.Units.Millisecond
instance GHC.Num.Num Data.Time.Units.Millisecond
instance Data.Data.Data Data.Time.Units.Millisecond
instance GHC.Real.Integral Data.Time.Units.Millisecond
instance GHC.Classes.Eq Data.Time.Units.Millisecond
instance GHC.Enum.Enum Data.Time.Units.Millisecond
instance GHC.Ix.Ix Data.Time.Units.Second
instance GHC.Real.Real Data.Time.Units.Second
instance GHC.Classes.Ord Data.Time.Units.Second
instance GHC.Num.Num Data.Time.Units.Second
instance Data.Data.Data Data.Time.Units.Second
instance GHC.Real.Integral Data.Time.Units.Second
instance GHC.Classes.Eq Data.Time.Units.Second
instance GHC.Enum.Enum Data.Time.Units.Second
instance GHC.Ix.Ix Data.Time.Units.Minute
instance GHC.Real.Real Data.Time.Units.Minute
instance GHC.Classes.Ord Data.Time.Units.Minute
instance GHC.Num.Num Data.Time.Units.Minute
instance Data.Data.Data Data.Time.Units.Minute
instance GHC.Real.Integral Data.Time.Units.Minute
instance GHC.Classes.Eq Data.Time.Units.Minute
instance GHC.Enum.Enum Data.Time.Units.Minute
instance GHC.Ix.Ix Data.Time.Units.Hour
instance GHC.Real.Real Data.Time.Units.Hour
instance GHC.Classes.Ord Data.Time.Units.Hour
instance GHC.Num.Num Data.Time.Units.Hour
instance Data.Data.Data Data.Time.Units.Hour
instance GHC.Real.Integral Data.Time.Units.Hour
instance GHC.Classes.Eq Data.Time.Units.Hour
instance GHC.Enum.Enum Data.Time.Units.Hour
instance GHC.Ix.Ix Data.Time.Units.Day
instance GHC.Real.Real Data.Time.Units.Day
instance GHC.Classes.Ord Data.Time.Units.Day
instance GHC.Num.Num Data.Time.Units.Day
instance Data.Data.Data Data.Time.Units.Day
instance GHC.Real.Integral Data.Time.Units.Day
instance GHC.Classes.Eq Data.Time.Units.Day
instance GHC.Enum.Enum Data.Time.Units.Day
instance GHC.Ix.Ix Data.Time.Units.Week
instance GHC.Real.Real Data.Time.Units.Week
instance GHC.Classes.Ord Data.Time.Units.Week
instance GHC.Num.Num Data.Time.Units.Week
instance Data.Data.Data Data.Time.Units.Week
instance GHC.Real.Integral Data.Time.Units.Week
instance GHC.Classes.Eq Data.Time.Units.Week
instance GHC.Enum.Enum Data.Time.Units.Week
instance GHC.Ix.Ix Data.Time.Units.Fortnight
instance GHC.Real.Real Data.Time.Units.Fortnight
instance GHC.Classes.Ord Data.Time.Units.Fortnight
instance GHC.Num.Num Data.Time.Units.Fortnight
instance Data.Data.Data Data.Time.Units.Fortnight
instance GHC.Real.Integral Data.Time.Units.Fortnight
instance GHC.Classes.Eq Data.Time.Units.Fortnight
instance GHC.Enum.Enum Data.Time.Units.Fortnight
instance Data.Time.Units.TimeUnit Data.Time.Units.Fortnight
instance GHC.Show.Show Data.Time.Units.Fortnight
instance GHC.Read.Read Data.Time.Units.Fortnight
instance Data.Time.Units.TimeUnit Data.Time.Units.Week
instance GHC.Show.Show Data.Time.Units.Week
instance GHC.Read.Read Data.Time.Units.Week
instance Data.Time.Units.TimeUnit Data.Time.Units.Day
instance GHC.Show.Show Data.Time.Units.Day
instance GHC.Read.Read Data.Time.Units.Day
instance Data.Time.Units.TimeUnit Data.Time.Units.Hour
instance GHC.Show.Show Data.Time.Units.Hour
instance GHC.Read.Read Data.Time.Units.Hour
instance Data.Time.Units.TimeUnit Data.Time.Units.Minute
instance GHC.Show.Show Data.Time.Units.Minute
instance GHC.Read.Read Data.Time.Units.Minute
instance Data.Time.Units.TimeUnit Data.Time.Units.Second
instance GHC.Show.Show Data.Time.Units.Second
instance GHC.Read.Read Data.Time.Units.Second
instance Data.Time.Units.TimeUnit Data.Time.Units.Millisecond
instance GHC.Show.Show Data.Time.Units.Millisecond
instance GHC.Read.Read Data.Time.Units.Millisecond
instance Data.Time.Units.TimeUnit Data.Time.Units.Microsecond
instance GHC.Show.Show Data.Time.Units.Microsecond
instance GHC.Read.Read Data.Time.Units.Microsecond
instance Data.Time.Units.TimeUnit Data.Time.Units.Nanosecond
instance GHC.Show.Show Data.Time.Units.Nanosecond
instance GHC.Read.Read Data.Time.Units.Nanosecond
instance Data.Time.Units.TimeUnit Data.Time.Units.Picosecond
instance GHC.Show.Show Data.Time.Units.Picosecond
instance GHC.Read.Read Data.Time.Units.Picosecond
instance Data.Time.Units.TimeUnit Data.Time.Units.Femtosecond
instance GHC.Show.Show Data.Time.Units.Femtosecond
instance GHC.Read.Read Data.Time.Units.Femtosecond
instance Data.Time.Units.TimeUnit Data.Time.Units.Attosecond
instance GHC.Show.Show Data.Time.Units.Attosecond
instance GHC.Read.Read Data.Time.Units.Attosecond
