378 |
my $interval = new( start=>'07:00', stop=>'17:00', |
my $interval = new( start=>'07:00', stop=>'17:00', |
379 |
dayMask=> DAY_WEEKDAY ); |
dayMask=> DAY_WEEKDAY ); |
380 |
|
|
381 |
# calculate current availability in seconds |
# calculate current uptime availability from now in seconds |
382 |
print $interval->uptime(localtime); |
print $interval->uptime(localtime); |
383 |
|
|
384 |
|
# calculate maximum downtime in seconds from current moment |
385 |
|
print $interval->downtime(localtime); |
386 |
|
|
387 |
# calculate availablity in seconds from interval of uptime |
# calculate availablity in seconds from interval of uptime |
388 |
print $interval->interval($utime1,$utime2); |
print $interval->interval($utime1,$utime2); |
389 |
|
|
394 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
395 |
|
|
396 |
Time::Available is used to calculate availability of some resource if start |
Time::Available is used to calculate availability of some resource if start |
397 |
end end time of availability is available. That availability is calculated |
and end time of availability is supplied. Availability is calculated |
398 |
relative to some interval which is defined when new instance of module is |
relative to some interval which is defined when new instance of module is |
399 |
created. |
created. |
400 |
|
|
401 |
Start and end dates must be specified in 24-hour format. You can specify |
Start and end dates must be specified in 24-hour format. You can specify |
402 |
just hour, hour:minute or hour:minute:seconds format. |
just hour, hour:minute or hour:minute:seconds format. Start and end time is |
403 |
|
specified in your B<local time zone>. Timestamp, are specified in unix |
404 |
|
utime, and module will take care of recalculating (using C<localtime> and |
405 |
|
C<timelocal> when needed). There is one small canvat here: module is assuing |
406 |
|
that time you are specifing is in same time zone in which your module is |
407 |
|
running (that is from local system). |
408 |
|
|
409 |
The B<dayMask> parameter is constructed by OR'ing together one or more of |
The B<dayMask> parameter is constructed by OR'ing together one or more of |
410 |
the following dayMask constants: |
the following dayMask constants: |
443 |
|
|
444 |
=back |
=back |
445 |
|
|
446 |
FIXME |
They should be self-explainatory. |
447 |
|
|
448 |
=head2 EXPORT |
=head2 EXPORT |
449 |
|
|
478 |
|
|
479 |
=head1 SEE ALSO |
=head1 SEE ALSO |
480 |
|
|
481 |
Time::Avail is CPAN module that started it all. However, it lacked |
L<Time::Avail> is CPAN module that started it all. However, it lacked |
482 |
calculating of availability of some interval and precision in seconds, so |
calculating of availability of some interval and precision in seconds, so |
483 |
this module was born. |
this module was born. It also had some bugs in dayMask which where reported |
484 |
|
to author, but his e-mail address bounced. |
485 |
|
|
486 |
More information about this module might be found on |
More information about this module might be found on |
487 |
http://www.rot13.org/~dpavlin/projects.html#cpan |
http://www.rot13.org/~dpavlin/projects.html#cpan |