Portability | Tested on Linux and Windows |
---|---|
Maintainer | joeyadams3.14159@gmail.com |
Safe Haskell | Safe-Infered |
This module provides more direct access to the system's monotonic clock, but provides less protection against wraparound.
More specifically, in the higher-level System.Time.Monotonic API,
Clock
updates its internal disposition every time
clockGetTime
is called. The only way to get a
wraparound issue with the higher-level API is to call
clockGetTime
very seldomly (e.g. less than once
every 24.8 days, if GetTickCount
is being used).
- getSystemClock :: IO SomeSystemClock
- data SomeSystemClock = forall time . SomeSystemClock (SystemClock time)
- data SystemClock time = SystemClock {
- systemClockGetTime :: IO time
- systemClockDiffTime :: time -> time -> DiffTime
- systemClockName :: String
- systemClock_MONOTONIC :: SystemClock CTimeSpec
- data CTimeSpec
Documentation
getSystemClock :: IO SomeSystemClockSource
Return a module used for accessing the system's monotonic clock. The
reason this is an IO
action, rather than simply a SystemClock
value, is
that the implementation may need to make a system call to determine what
monotonic time source to use, and how to use it.
data SomeSystemClock Source
Existentially-quantified wrapper around SystemClock
forall time . SomeSystemClock (SystemClock time) |
data SystemClock time Source
SystemClock | |
|
Show (SystemClock time) |
Implementation(s)
The set of definitions below is platform-dependent.
systemClock_MONOTONIC :: SystemClock CTimeSpecSource
Uses clock_gettime
with CLOCK_MONOTONIC
.
Warning: on Linux, this clock stops when the computer is suspended. See http://lwn.net/Articles/434239/.