28 Jul 1999 02:40:05 UTC
- Distribution: BSD-Itimer
- Module version: 0.8
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (379 / 0 / 0)
- KwaliteeBus factor: 0
- 82.35% Coverage
- License: unknown
- Activity24 month
- Download (4.18KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
BSD::Itimer - Perl extension for accessing interval timers
use BSD::Itimer; my($interval_sec, $interval_usec, $current_sec, $current_usec) = getitimer(ITIMER_REAL); my($interval_sec, $interval_usec, $current_sec, $current_usec) = setitimer(ITIMER_REAL, $interval_sec, $interval_usec, $current_sec, $current_usec));
This module provides access to the interval timers many operating systems provide from perl. Interval timers conceptually have microsecond resolution (hardware typically limits actual granularity), with the ability to reschedule the timer on a fixed repeating interval. There are usually several timers available with a different concept of "time".
The interval timer is accessed by two exported functions, getitimer and setitimer. Most Unix systems have three interval timers available for program use. The current BSD::Itimer implementation knows about the following timers, where implemented:
ITIMER_REAL - This timer decrements in real time. A SIGALRM is delivered when this timer expires.
ITIMER_VIRTUAL - This timer decrements in real time when the calling process is running. Delivers SIGVTALRM when it expires.
ITIMER_PROF - This timer runs when the calling process is running, and when the operating system is operating on behalf of the calling process. A SIGPROF is delivered when the timer expires.
ITIMER_REALPROF - This timer is available under Solaris only. Consult the setitimer(2) manual page for more information.
Interval timers are represented as four item integer lists. The first two integers comprise the second and microsecond parts of the timer's repeat interval. The second pair represent the second and microsecond parts of the current timer value.
The getitimer function expects a single argument naming the timer to fetch. It returns a four element list, or an empty list on failure.
The setitimer function expects a argument naming the timer to set, and a four element list representing the interval. It returns the previous setting of the timer, or an empty list on failure. Setting a timer's repeat interval to 0 will cancel the timer after its next delivery. Setting it's current value to 0 will immediately cancel the timer.
Daniel Hagerty <email@example.com>
Copyright (c) 1999 Daniel Hagerty. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Could use a friendly interface.