/[Time-Available]/Available.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Available.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by dpavlin, Mon Oct 6 22:32:25 2003 UTC revision 1.10 by dpavlin, Wed Oct 8 19:23:31 2003 UTC
# Line 378  Time::Available - Perl extension to calc Line 378  Time::Available - Perl extension to calc
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    
# Line 391  Time::Available - Perl extension to calc Line 394  Time::Available - Perl extension to calc
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:
# Line 435  Time::Available::DAY_EVERYDAY Line 443  Time::Available::DAY_EVERYDAY
443    
444  =back  =back
445    
446  FIXME  They should be self-explainatory.
447    
448  =head2 EXPORT  =head2 EXPORT
449    
# Line 470  Allow arbitary (array?) of holidays to b Line 478  Allow arbitary (array?) of holidays to b
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

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.26