Safe Haskell | Safe |
---|---|
Language | Haskell98 |
System.Clock
Description
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#
Documentation
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. (The only suspend-aware monotonic is CLOCK_BOOTTIME on Linux.)
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
|
Realtime | The identifier of the system-wide clock measuring real time. For this
clock, the value returned by |
ProcessCPUTime | The identifier of the CPU-time clock associated with the calling
process. For this clock, the value returned by |
ThreadCPUTime | The identifier of the CPU-time clock associated with the calling OS
thread. For this clock, the value returned by |
MonotonicRaw | (since Linux 2.6.28; Linux-specific) Similar to CLOCK_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). |
Instances
Enum Clock # | |
Eq Clock # | |
Read Clock # | |
Show Clock # | |
Generic Clock # | |
type Rep Clock # | |
Defined in System.Clock type Rep Clock = D1 (MetaData "Clock" "System.Clock" "clock-0.7.2-DpdvDKMysiO5fhuByT1Vyj" 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)))) |
TimeSpec structure
Instances
Eq TimeSpec # | |
Num TimeSpec # | |
Ord TimeSpec # | |
Defined in System.Clock | |
Read TimeSpec # | |
Show TimeSpec # | |
Generic TimeSpec # | |
Storable TimeSpec # | |
Defined in System.Clock | |
type Rep TimeSpec # | |
Defined in System.Clock type Rep TimeSpec = D1 (MetaData "TimeSpec" "System.Clock" "clock-0.7.2-DpdvDKMysiO5fhuByT1Vyj" False) (C1 (MetaCons "TimeSpec" PrefixI True) (S1 (MetaSel (Just "sec") SourceUnpack SourceStrict DecidedStrict) (Rec0 Int64) :*: S1 (MetaSel (Just "nsec") SourceUnpack SourceStrict DecidedStrict) (Rec0 Int64))) |
getTime :: Clock -> IO TimeSpec #
The getTime
function shall return the current value for the
specified clock.
getRes :: 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.
fromNanoSecs :: Integer -> TimeSpec #
TimeSpec from nano seconds.
toNanoSecs :: TimeSpec -> Integer #
TimeSpec to nano seconds.
diffTimeSpec :: TimeSpec -> TimeSpec -> TimeSpec #
Compute the absolute difference.
timeSpecAsNanoSecs :: TimeSpec -> Integer #
Deprecated: Use toNanoSecs instead! Replaced timeSpecAsNanoSecs with the same signature TimeSpec -> Integer
TimeSpec as nano seconds.