| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
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#
Synopsis
- data Clock
- data TimeSpec = TimeSpec {}
- getTime :: Clock -> IO TimeSpec
- getRes :: Clock -> IO TimeSpec
- fromNanoSecs :: Integer -> TimeSpec
- toNanoSecs :: TimeSpec -> Integer
- diffTimeSpec :: TimeSpec -> TimeSpec -> TimeSpec
- timeSpecAsNanoSecs :: TimeSpec -> Integer
- normalize :: TimeSpec -> TimeSpec
- s2ns :: Num a => a
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 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
|
| 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, macOS 10.12)
Similar to |
| Boottime | (since Linux 2.6.39; Linux-specific)
Identical to |
| MonotonicCoarse | (since Linux 2.6.32; Linux-specific)
A faster but less precise version of |
| RealtimeCoarse | (since Linux 2.6.32; Linux-specific)
A faster but less precise version of |
Instances
TimeSpec structure
Instances
| Bounded TimeSpec Source # | |||||
| Enum TimeSpec Source # | |||||
Defined in System.Clock Methods succ :: TimeSpec -> TimeSpec Source # pred :: TimeSpec -> TimeSpec Source # toEnum :: Int -> TimeSpec Source # fromEnum :: TimeSpec -> Int Source # enumFrom :: TimeSpec -> [TimeSpec] Source # enumFromThen :: TimeSpec -> TimeSpec -> [TimeSpec] Source # enumFromTo :: TimeSpec -> TimeSpec -> [TimeSpec] Source # enumFromThenTo :: TimeSpec -> TimeSpec -> TimeSpec -> [TimeSpec] Source # | |||||
| Storable TimeSpec Source # | |||||
Defined in System.Clock Methods sizeOf :: TimeSpec -> Int Source # alignment :: TimeSpec -> Int Source # peekElemOff :: Ptr TimeSpec -> Int -> IO TimeSpec Source # pokeElemOff :: Ptr TimeSpec -> Int -> TimeSpec -> IO () Source # peekByteOff :: Ptr b -> Int -> IO TimeSpec Source # pokeByteOff :: Ptr b -> Int -> TimeSpec -> IO () Source # | |||||
| Generic TimeSpec Source # | |||||
Defined in System.Clock Associated Types
| |||||
| Num TimeSpec Source # | |||||
Defined in System.Clock Methods (+) :: TimeSpec -> TimeSpec -> TimeSpec Source # (-) :: TimeSpec -> TimeSpec -> TimeSpec Source # (*) :: TimeSpec -> TimeSpec -> TimeSpec Source # negate :: TimeSpec -> TimeSpec Source # abs :: TimeSpec -> TimeSpec Source # signum :: TimeSpec -> TimeSpec Source # fromInteger :: Integer -> TimeSpec Source # | |||||
| Read TimeSpec Source # | |||||
| Integral TimeSpec Source # | |||||
Defined in System.Clock Methods quot :: TimeSpec -> TimeSpec -> TimeSpec Source # rem :: TimeSpec -> TimeSpec -> TimeSpec Source # div :: TimeSpec -> TimeSpec -> TimeSpec Source # mod :: TimeSpec -> TimeSpec -> TimeSpec Source # quotRem :: TimeSpec -> TimeSpec -> (TimeSpec, TimeSpec) Source # divMod :: TimeSpec -> TimeSpec -> (TimeSpec, TimeSpec) Source # | |||||
| Real TimeSpec Source # | |||||
Defined in System.Clock Methods toRational :: TimeSpec -> Rational Source # | |||||
| Show TimeSpec Source # | |||||
| Eq TimeSpec Source # | |||||
| Ord TimeSpec Source # | |||||
Defined in System.Clock | |||||
| type Rep TimeSpec Source # | |||||
Defined in System.Clock type Rep TimeSpec = D1 ('MetaData "TimeSpec" "System.Clock" "clock-0.8.4-H2gxghH0gZSWFOI5QDUKZ" '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 Source #
The getTime function shall return the current value for the
specified clock.
getRes :: Clock -> IO TimeSpec 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 -> TimeSpec Source #
TimeSpec from nano seconds.
toNanoSecs :: TimeSpec -> Integer Source #
TimeSpec to nano seconds.
timeSpecAsNanoSecs :: TimeSpec -> Integer Source #
Deprecated: Use toNanoSecs instead! Replaced timeSpecAsNanoSecs with the same signature TimeSpec -> Integer
TimeSpec as nano seconds.