clock-0.8.3: High-resolution clock functions: monotonic, realtime, cputime.
Safe Haskell None
Language Haskell2010

System.Clock.Seconds

Synopsis

Documentation

data Clock Source #

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 .

Constructors

Monotonic

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 )

Realtime

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 )

ProcessCPUTime

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.

ThreadCPUTime

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.

MonotonicRaw

(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 )

Instances

Instances details
Enum Clock Source #
Instance details

Defined in System.Clock

Eq Clock Source #
Instance details

Defined in System.Clock

Read Clock Source #
Instance details

Defined in System.Clock

Show Clock Source #
Instance details

Defined in System.Clock

Generic Clock Source #
Instance details

Defined in System.Clock

type Rep Clock Source #
Instance details

Defined in System.Clock

type Rep Clock = D1 (' MetaData "Clock" "System.Clock" "clock-0.8.3-Kuh58kurzD7fuR5UAL40C" ' False ) (( C1 (' MetaCons "Monotonic" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "Realtime" ' PrefixI ' False ) ( U1 :: Type -> Type )) :+: ( C1 (' MetaCons "ProcessCPUTime" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: ( C1 (' MetaCons "ThreadCPUTime" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "MonotonicRaw" ' PrefixI ' False ) ( U1 :: Type -> Type ))))

newtype Seconds Source #

Constructors

Seconds

Instances

Instances details
Bounded Seconds Source #
Instance details

Defined in System.Clock.Seconds

Enum Seconds Source #
Instance details

Defined in System.Clock.Seconds

Eq Seconds Source #
Instance details

Defined in System.Clock.Seconds

Fractional Seconds Source #
Instance details

Defined in System.Clock.Seconds

Num Seconds Source #
Instance details

Defined in System.Clock.Seconds

Ord Seconds Source #
Instance details

Defined in System.Clock.Seconds

Read Seconds Source #
Instance details

Defined in System.Clock.Seconds

Real Seconds Source #
Instance details

Defined in System.Clock.Seconds

RealFrac Seconds Source #
Instance details

Defined in System.Clock.Seconds

Show Seconds Source #
Instance details

Defined in System.Clock.Seconds

Generic Seconds Source #
Instance details

Defined in System.Clock.Seconds

Storable Seconds Source #
Instance details

Defined in System.Clock.Seconds

type Rep Seconds Source #
Instance details

Defined in System.Clock.Seconds

type Rep Seconds = D1 (' MetaData "Seconds" "System.Clock.Seconds" "clock-0.8.3-Kuh58kurzD7fuR5UAL40C" ' True ) ( C1 (' MetaCons "Seconds" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "toTimeSpec") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TimeSpec )))

getTime :: Clock -> IO Seconds Source #

The getTime function shall return the current value for the specified clock.

getRes :: Clock -> IO Seconds Source #

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

fromNanoSecs :: Integer -> Seconds Source #

Seconds from nano seconds.

diffTimeSpec :: Seconds -> Seconds -> Seconds Source #

Compute the absolute difference.