posix-timer-0.0.3: Bindings to POSIX clock and timer functions.




POSIX clocks and timers.



newtype Clock Source

Mirrors clockid_t.


Clock Int32 

getProcClock :: ProcessID -> IO ClockSource

Get the CPU-time clock of the given process. See clock_getcpuclockid(3).

getClockResolution :: Clock -> IO TimeSpecSource

Get the clock resolution. See clock_getres(3).

getClockTime :: Clock -> IO TimeSpecSource

Get the clock time. See clock_gettime(3).

setClockTime :: Clock -> TimeSpec -> IO ()Source

Set the clock time. See clock_settime(3).

clockSleep :: Clock -> TimeSpec -> IO TimeSpecSource

Sleep for the specified duration. When interrupted by a signal, returns the amount of time left to sleep. See clock_nanosleep(3).

clockSleepAbs :: Clock -> TimeSpec -> IO ()Source

Sleep until the clock time reaches the specified value. See clock_nanosleep(3).


mkTimeSpec :: CTime -> CULong -> TimeSpecSource

Create a TimeSpec from amounts of seconds and nanoseconds.

timeSpecV :: TimeSpec -> (CTime, CULong)Source

Convert a TimeSpec to a pair of its components. Useful as a view pattern.

timeSpecToNum :: Num a => TimeSpec -> aSource

The total amount of time a TimeSpec represents, in nanoseconds.

timeSpecToInt64 :: TimeSpec -> Int64Source

Specialized version of timeSpecToNum.

data ITimerSpec Source

Mirrors struct itimerspec.

data Timer Source

Mirrors timer_t.



:: Clock 
-> Maybe (Signal, WordPtr)

Optional signal to raise on timer expirations and value of siginfo.si_value.

-> IO Timer 

Create a timer. See timer_create(3).



:: Timer 
-> Bool

Whether the expiration time is absolute.

-> TimeSpec

Expiration time. Zero value disarms the timer.

-> TimeSpec

Interval between subsequent expirations.

-> IO (TimeSpec, TimeSpec) 

Setup the timer. See timer_settime(3).

timerTimeLeft :: Timer -> IO (TimeSpec, TimeSpec)Source

Get the amount of time left until the next expiration and the interval between the subsequent expirations. See timer_gettime(3).

timerOverrunCnt :: Timer -> IO CIntSource

Get the timer overrun count. See timer_getoverrun(3).

destroyTimer :: Timer -> IO ()Source

Destroy the timer. See timer_delete(3).