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

-- | High-resolution clock functions: monotonic, realtime, cputime.
--   
--   A package for convenient access to high-resolution clock and timer
--   functions of different operating systems via a unified API.
--   
--   POSIX code and surface API was developed by Cetin Sert in 2009.
--   
--   Windows code was contributed by Eugene Kirpichov in 2010.
--   
--   FreeBSD code was contributed by Finn Espen Gundersen on 2013-10-14.
--   
--   OS X code was contributed by Gerolf Seitz on 2013-10-15.
--   
--   Derived Generic, Typeable and other instances for
--   Clock and TimeSpec was contributed by Mathieu
--   Boespflug on 2014-09-17.
--   
--   Corrected dependency listing for GHC < 7.6 was contributed
--   by Brian McKenna on 2014-09-30.
--   
--   Windows code corrected by Dimitri Sabadie on 2015-02-09.
--   
--   Added timeSpecAsNanoSecs as observed widely-used by Chris
--   Done on 2015-01-06, exported correctly on 2015-04-20.
--   
--   Imported Control.Applicative operators correctly for Haskell Platform
--   on Windows on 2015-04-21.
--   
--   Unit tests and instance fixes by Christian Burger on 2015-06-25.
--   
--   Removal of fromInteger : Integer -> TimeSpec by Cetin Sert on
--   2015-12-15.
--   
--   New Linux-specific Clocks: MonotonicRaw, Boottime, MonotonicCoarse,
--   RealtimeCoarse by Cetin Sert on 2015-12-15.
--   
--   Reintroduction fromInteger : Integer -> TimeSpec by Cetin Sert on
--   2016-04-05.
--   
--   Fixes for older Linux build failures introduced by new Linux-specific
--   clocks by Mario Longobardi on 2016-04-18.
--   
--   Refreshment release in 2019-04 after numerous contributions.
--   
--   Refactoring for Windows, Mac implementation consistence by Alexander
--   Vershilov on 2021-01-16.
--   
--   
--   
- Version Scheme Major-R-ewrite .
--   New-F-unctionality .
--   I-mprovementAndBugFixes .
--   P-ackagingOnly
--   
--   
--   
--   
- PackagingOnly changes are made for quality assurance
--   reasons.
--   
@package clock
@version 0.8.4

-- | High-resolution, realtime clock and timer functions for Posix systems.
--   This module is being developed according to IEEE Std 1003.1-2008:
--   http://www.opengroup.org/onlinepubs/9699919799/,
--   http://www.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html#
module System.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 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 getTime 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. (Identical to Boottime since Linux 4.17, see
--   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d6ed449afdb38f89a7b38ec50e367559e1b8f71f)
--   CLOCK_MONOTONIC (macOS - SYSTEM_CLOCK)
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.
--   CLOCK_REALTIME (macOS - CALENDAR_CLOCK, Windows -
--   GetSystemTimeAsFileTime)
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

-- | (since Linux 2.6.28, macOS 10.12) Similar to Monotonic, but
--   provides access to a raw hardware-based time that is not subject to
--   NTP adjustments or the incremental adjustments performed by
--   adjtime(3). CLOCK_MONOTONIC_RAW (Windows -
--   QueryPerformanceCounter, QueryPerformanceFrequency)
MonotonicRaw :: Clock

-- | (since Linux 2.6.39; Linux-specific) Identical to Monotonic,
--   except it also includes any time that the system is suspended. This
--   allows applications to get a suspend-aware monotonic clock without
--   having to deal with the complications of Realtime, which may
--   have discontinuities if the time is changed using settimeofday(2).
--   (since Linux 4.17; identical to Monotonic)
--   CLOCK_BOOTTIME
Boottime :: Clock

-- | (since Linux 2.6.32; Linux-specific) A faster but less precise version
--   of Monotonic. Use when you need very fast, but not fine-grained
--   timestamps. CLOCK_MONOTONIC_COARSE
MonotonicCoarse :: Clock

-- | (since Linux 2.6.32; Linux-specific) A faster but less precise version
--   of Realtime. Use when you need very fast, but not fine-grained
--   timestamps. CLOCK_REALTIME_COARSE
RealtimeCoarse :: Clock

-- | TimeSpec structure
data TimeSpec
TimeSpec :: {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Int64 -> TimeSpec

-- | seconds
[sec] :: TimeSpec -> {-# UNPACK #-} !Int64

-- | nanoseconds
[nsec] :: TimeSpec -> {-# UNPACK #-} !Int64

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

-- | The getRes function shall return the resolution of any clock.
--   Clock resolutions are implementation-defined and cannot be set by a
--   process.
getRes :: Clock -> IO TimeSpec

-- | TimeSpec from nano seconds.
fromNanoSecs :: Integer -> TimeSpec

-- | TimeSpec to nano seconds.
toNanoSecs :: TimeSpec -> Integer

-- | Compute the absolute difference.
diffTimeSpec :: TimeSpec -> TimeSpec -> TimeSpec

-- | TimeSpec as nano seconds.

-- | Deprecated: Use toNanoSecs instead! Replaced timeSpecAsNanoSecs
--   with the same signature TimeSpec -> Integer
timeSpecAsNanoSecs :: TimeSpec -> Integer
normalize :: TimeSpec -> TimeSpec
s2ns :: Num a => a
instance GHC.Internal.Enum.Bounded System.Clock.TimeSpec
instance GHC.Internal.Enum.Enum System.Clock.Clock
instance GHC.Internal.Enum.Enum System.Clock.TimeSpec
instance GHC.Classes.Eq System.Clock.Clock
instance GHC.Classes.Eq System.Clock.TimeSpec
instance GHC.Internal.Generics.Generic System.Clock.Clock
instance GHC.Internal.Generics.Generic System.Clock.TimeSpec
instance GHC.Internal.Real.Integral System.Clock.TimeSpec
instance GHC.Internal.Num.Num System.Clock.TimeSpec
instance GHC.Classes.Ord System.Clock.TimeSpec
instance GHC.Internal.Read.Read System.Clock.Clock
instance GHC.Internal.Read.Read System.Clock.TimeSpec
instance GHC.Internal.Real.Real System.Clock.TimeSpec
instance GHC.Internal.Show.Show System.Clock.Clock
instance GHC.Internal.Show.Show System.Clock.TimeSpec
instance GHC.Internal.Foreign.Storable.Storable System.Clock.TimeSpec

module System.Clock.Seconds

-- | 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 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 getTime 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. (Identical to Boottime since Linux 4.17, see
--   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d6ed449afdb38f89a7b38ec50e367559e1b8f71f)
--   CLOCK_MONOTONIC (macOS - SYSTEM_CLOCK)
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.
--   CLOCK_REALTIME (macOS - CALENDAR_CLOCK, Windows -
--   GetSystemTimeAsFileTime)
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

-- | (since Linux 2.6.28, macOS 10.12) Similar to Monotonic, but
--   provides access to a raw hardware-based time that is not subject to
--   NTP adjustments or the incremental adjustments performed by
--   adjtime(3). CLOCK_MONOTONIC_RAW (Windows -
--   QueryPerformanceCounter, QueryPerformanceFrequency)
MonotonicRaw :: Clock

-- | (since Linux 2.6.39; Linux-specific) Identical to Monotonic,
--   except it also includes any time that the system is suspended. This
--   allows applications to get a suspend-aware monotonic clock without
--   having to deal with the complications of Realtime, which may
--   have discontinuities if the time is changed using settimeofday(2).
--   (since Linux 4.17; identical to Monotonic)
--   CLOCK_BOOTTIME
Boottime :: Clock

-- | (since Linux 2.6.32; Linux-specific) A faster but less precise version
--   of Monotonic. Use when you need very fast, but not fine-grained
--   timestamps. CLOCK_MONOTONIC_COARSE
MonotonicCoarse :: Clock

-- | (since Linux 2.6.32; Linux-specific) A faster but less precise version
--   of Realtime. Use when you need very fast, but not fine-grained
--   timestamps. CLOCK_REALTIME_COARSE
RealtimeCoarse :: Clock
newtype Seconds
Seconds :: TimeSpec -> Seconds
[toTimeSpec] :: Seconds -> TimeSpec

-- | The getTime function shall return the current value for the
--   specified clock.
getTime :: Clock -> IO Seconds

-- | The getRes function shall return the resolution of any clock.
--   Clock resolutions are implementation-defined and cannot be set by a
--   process.
getRes :: Clock -> IO Seconds

-- | Seconds from nano seconds.
fromNanoSecs :: Integer -> Seconds

-- | Seconds to nano seconds.
toNanoSecs :: Seconds -> Integer

-- | Compute the absolute difference.
diffTimeSpec :: Seconds -> Seconds -> Seconds
instance GHC.Internal.Enum.Bounded System.Clock.Seconds.Seconds
instance GHC.Internal.Enum.Enum System.Clock.Seconds.Seconds
instance GHC.Classes.Eq System.Clock.Seconds.Seconds
instance GHC.Internal.Real.Fractional System.Clock.Seconds.Seconds
instance GHC.Internal.Generics.Generic System.Clock.Seconds.Seconds
instance GHC.Internal.Num.Num System.Clock.Seconds.Seconds
instance GHC.Classes.Ord System.Clock.Seconds.Seconds
instance GHC.Internal.Read.Read System.Clock.Seconds.Seconds
instance GHC.Internal.Real.RealFrac System.Clock.Seconds.Seconds
instance GHC.Internal.Real.Real System.Clock.Seconds.Seconds
instance GHC.Internal.Show.Show System.Clock.Seconds.Seconds
instance GHC.Internal.Foreign.Storable.Storable System.Clock.Seconds.Seconds
