My Opera is closing 1st of March

M.I.T = Multimedia IT dept.

Subscribe to RSS feed

check time schdeule with Perl: checktime.pl

, ,

use Date::Calc qw(Day_of_Week);

open CONFIG, "schedule.ini" or die "open schedule.ini fail: $!";
while (<CONFIG>) {
chomp; # no new line
s/#.*//; # no comments
s/^\s+//; # no loading white
s/\s+$//; # no trailing white
next unless length; # anything left?
my ($sdow,$stime,$etime) = split(/,/,$_,3);
my ($shour,$smin) = split(/:/,$stime,2);
my ($ehour,$emin) = split(/:/,$etime,2);
# get localtime via perl function
($sec,$min,$hour,$day,$mon,$year)=localtime(time);
$mon++;
$year+=1900;
$dow = Day_of_Week($year,$mon,$day);

if ($sdow == $dow and $hour == $shour and $min == $smin) {
print "INSERTNOW";}
if ($sdow == $dow and $hour == $ehour and $min == $emin) {
print "INSERTEND";}

}

# Format of schedule.ini
# Day_of_week,Start_time,End_time. Sunday is 7.
# 7,11:20,11:22
February 2014
M T W T F S S
January 2014March 2014
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28