POSIX::RT::Clock - POSIX real-time clocks
Version 0.008
use POSIX::RT::Timer; my $timer = POSIX::RT::Clock->new('monotonic'); $timer->sleep(1);
POSIX::RT::Clock offers access to various clocks, both portable and OS dependent.
new($type)
Create a new clock. The $types supported are documented in get_clocks.
$type
get_clocks
get_clocks()
Get a list of all supported clocks. These will be returned by their names, not as objects. Possible values include (but may not be limited to):
realtime
The same clock as time and Time::HiRes use. It is the only timer guaranteed to always available and is therefor the default.
time
monotonic
A non-settable clock guaranteed to be monotonic. This is defined in POSIX and supported on most operating systems.
process
A clock that measures (user and system) CPU time consumed by (all of the threads in) the calling process. This is supported on many operating systems.
thread
A clock that measures (user and system) CPU time consumed by the calling thread. This is Linux specific.
uptime
A clock that measures the uptime of the system. This is FreeBSD specific.
virtual
A clock that counts time the process spent in userspace. This is supported only in FreeBSD, NetBSD and Solaris.
get_cpuclock($pid = 0)
Get the cpu-time clock for the process specified in $pid. If $pid is zero the current process is taken, this is the same as the process clock. This call is currently not supported on most operating systems, despite being defined in POSIX.
get_time()
Get the time of this clock.
set_time($time)
Set the time of this clock. Note that this may not make sense on clocks other than realtime and will require sysadmin permissions.
get_resolution()
Get the resolution of this clock.
sleep($time, $abstime = 0)
Sleep a $time seconds on this clock. Note that it is never restarted after interruption by a signal handler. It returns the remaining time. $time and the return value are relative time unless $abstime is true. This function may not be available on some operating systems.
$time
$abstime
sleep_deeply($time, $abstime = 0)
Sleep a $time seconds on this clock. Unlike sleep, it will retry on interruption until the time has passed. This function may not be available on some operating systems.
sleep
timer(%options)
Create a timer based on this clock. All arguments except clock as the same as in POSIX::RT::Timer::new.
clock
POSIX::RT::Timer::new
Leon Timmermans, <leont at cpan.org>
<leont at cpan.org>
Please report any bugs or feature requests to bug-posix-rt-timer at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POSIX-RT-Timer. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-posix-rt-timer at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc POSIX::RT::Clock
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=POSIX-RT-Timer
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/POSIX-RT-Timer
CPAN Ratings
http://cpanratings.perl.org/d/POSIX-RT-Timer
Search CPAN
http://search.cpan.org/dist/POSIX-RT-Timer/
Copyright 2010 Leon Timmermans.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install POSIX::RT::Timer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POSIX::RT::Timer
CPAN shell
perl -MCPAN -e shell install POSIX::RT::Timer
For more information on module installation, please visit the detailed CPAN module installation guide.