NAME

Time::Avail - A Perl module to calculate time availability.


SYNOPSIS

use Time::Avail;

$minRemaining = timeAvailable( $timeStartStr, $timeEndStr, $dayMask );


DESCRIPTION

The timeAvailable function compares the time interval specified by timeStartStr, timeEndStr, and dayMask with the current day and time. timeAvailable returns 0 if the current day and time do not fall within the specified time interval, otherwise the number of minutes remaining is returned. timeStartStr and timeEndStr are string parameters that must adhere to a HH:MM 24 hour format, where HH represents a two digit hour value and MM represents a two digit minute value. dayMask is a bitmask which specifies the valid days for the time interval.

The dayMask parameter is constructed by OR'ing together one or more of the following dayMask constants:


EXAMPLES

To calculate the time remaining given a starting time of 5am and an ending time of 5pm for Sunday and Monday, the call to timeAvailable can be coded as follows:

$minRemaining = timeAvailable( "05:00", "17:00", Time::Avail::DAY_SUNDAY | Time::Avail::DAY_MONDAY );

To calculate the time remaining given a starting time of 10:30am and an ending time of 7:45pm for Saturday, Sunday, and Monday, the call to timeAvailable can be coded as follows:

$minRemaining = timeAvailable( "10:30", "19:45", Time::Avail::DAY_SATURDAY | Time::Avail::DAY_SUNDAY |Time::Avail::DAY_MONDAY );

or

$minRemaining = timeAvailable( "10:30", "19:45", Time::Avail::DAY_WEEKEND | Time::Avail::DAY_MONDAY );

To calculate the time remaining given a starting time of 7am and an ending time of 7pm for everyday but Saturday and Sunday, the call to timeAvailable can be coded as follows:

$minRemaining = timeAvailable( "07:00", "19:00", Time::Avail::DAY_WEEKDAY );

To calculate the time remaining given a starting time of 10pm and an ending time of 2am for everyday, the call to timeAvailable can be coded as follows:

$minRemaining = timeAvailable( "22:00", "02:00", Time::Avail::DAY_EVERYDAY );


VERSION

1.00


HISTORY

        Version 1.00
        ------------
                - Released.


AUTHOR

Peter Santoro peter@pscomp.com


COPYRIGHT

Copyright (c) 1998 Peter Santoro. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself; however, you must leave this copyright statement intact.


DATE

December 19, 1998


SOURCE

This distribution can be also be found at the author's web site:

        http://www.connix.com/~psantoro/