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


-- | High-resolution clock and timer functions:
realtime, monotonic, cputime, etc.
--   
--   A package for convenient access to high-resolution clock and timer
--   functions of different operating systems.
--   
--   It is planned to consist of two layers. The lower layer will provide
--   direct access to OS-specific clock and timer functions like
--   clock_gettime of Posix or GetTickCount of Windows and its upper layer
--   shall then provide a common API for all supported systems. Currently
--   only the lower level is being developed.
--   
--   POSIX reference: IEEE Std 1003.1-2008
--   <a>http://www.opengroup.org/onlinepubs/9699919799/</a>,
--   <a>http://www.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html#</a>
--   
--   WINDOWS reference: ...
--   
--   For more information, see:
--   <a>http://corsis.sourceforge.net/index.php/Haskell/Clock</a>
@package clock
@version 0.2.0.0


-- | High-resolution, realtime clock and timer functions for Posix systems.
--   This module is being developed according to IEEE Std 1003.1-2008:
--   <a>http://www.opengroup.org/onlinepubs/9699919799/</a>,
--   <a>http://www.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html#</a>
module System.Posix.Clock

-- | Clock types. A clock may be system-wide (that is, visible to all
--   processes) or per-process (measuring time that is meaningful only
--   within a process). All implementations shall support CLOCK_REALTIME.
data Clock

-- | The identifier for the system-wide monotonic clock, which is defined
--   as a clock measuring real time, whose value cannot be set via
--   clock_settime and which cannot have negative clock jumps. The maximum
--   possible clock jump shall be implementation-defined. For this clock,
--   the value returned by <a>getTime</a> represents the amount of time (in
--   seconds and nanoseconds) since an unspecified point in the past (for
--   example, system start-up time, or the Epoch). This point does not
--   change after system start-up time. Note that the absolute value of the
--   monotonic clock is meaningless (because its origin is arbitrary), and
--   thus there is no need to set it. Furthermore, realtime applications
--   can rely on the fact that the value of this clock is never set.
Monotonic :: Clock

-- | The identifier of the system-wide clock measuring real time. For this
--   clock, the value returned by getTime represents the amount of time (in
--   seconds and nanoseconds) since the Epoch.
Realtime :: Clock

-- | The identifier of the CPU-time clock associated with the calling
--   process. For this clock, the value returned by getTime represents the
--   amount of execution time of the current process.
ProcessCPUTime :: Clock

-- | The identifier of the CPU-time clock associated with the calling OS
--   thread. For this clock, the value returned by getTime represents the
--   amount of execution time of the current OS thread.
ThreadCPUTime :: Clock

-- | TimeSpec structure
data TimeSpec
TimeSpec :: Int -> Int -> TimeSpec

-- | Seconds
sec :: TimeSpec -> Int

-- | Nanoseconds
nsec :: TimeSpec -> Int

-- | The <a>getTime</a> function shall return the current value for the
--   specified clock.
getTime :: Clock -> IO TimeSpec

-- | The <a>getRes</a> function shall return the resolution of any clock.
--   Clock resolutions are implementation-defined and cannot be set by a
--   process.
getRes :: Clock -> IO TimeSpec
instance Show TimeSpec
instance Read TimeSpec
instance Eq TimeSpec
instance Ord TimeSpec
instance Storable TimeSpec
