####
#---------------------------------------------------------------------------------------
# Convert supplied date to Epoch time
#---------------------------------------------------------------------------------------
sub toEpoch
{
my $date = shift;
my ($epoch, @suppliedTime, @suppliedDate);
my @tempdate = split/\s/, $date;
@suppliedTime = split/:/, $tempdate[1];
if (uc($tempdate[0]) eq "EVERY") {
#print "\t\t**This will return the epoch to this time TODAY**\n";
$epoch = timelocal(0, $suppliedTime[1], $suppliedTime[0], (localtime)[3], (localtime)[4], ((localtime)[5]+1900));
}
else {
@suppliedDate = split/-/, $tempdate[0];
$epoch = timelocal(0, $suppliedTime[1], $suppliedTime[0], $suppliedDate[0], ($suppliedDate[1] - 1), $suppliedDate[2]);
}
return($epoch);
}
####
####
my $configuredDayFromXML = "mon"; #obtain from configuration
my @daysOfWeek = ('Sun', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun');
if ($configuredDayFromXML eq $daysOfWeek[(localtime)[6]]) {
if (! check if we are between the start and end time) {
perform action;
}
}