GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
IO::Async::Timer::Absolute(3) User Contributed Perl Documentation IO::Async::Timer::Absolute(3)

"IO::Async::Timer::Absolute" - event callback at a fixed future time

   use IO::Async::Timer::Absolute;

   use POSIX qw( mktime );

   use IO::Async::Loop;
   my $loop = IO::Async::Loop->new;

   my @time = gmtime;

   my $timer = IO::Async::Timer::Absolute->new(
      time => mktime( 0, 0, 0, $time[3]+1, $time[4], $time[5] ),

      on_expire => sub {
         print "It's midnight\n";
         $loop->stop;
      },
   );

   $loop->add( $timer );

   $loop->run;

This subclass of IO::Async::Timer implements one-shot events at a fixed time in the future. The object waits for a given timestamp, and invokes its callback at that point in the future.

For a "Timer" object that waits for a delay relative to the time it is started, see instead IO::Async::Timer::Countdown.

The following events are invoked, either using subclass methods or CODE references in parameters:

Invoked when the timer expires.

The following named parameters may be passed to "new" or "configure":

CODE reference for the "on_expire" event.

The epoch time at which the timer will expire.

Once constructed, the timer object will need to be added to the "Loop" before it will work.

Unlike other timers, it does not make sense to "start" this object, because its expiry time is absolute, and not relative to the time it is started.

Paul Evans <leonerd@leonerd.org.uk>
2022-04-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.