Date_InitStrings($lang{"past"}, \$Lang{$L}{"Past"}, "lc,sort");
Date_InitStrings($lang{"next"}, \$Lang{$L}{"Next"}, "lc,sort");
Date_InitStrings($lang{"prev"}, \$Lang{$L}{"Prev"}, "lc,sort");
Date_InitStrings($lang{"of"}, \$Lang{$L}{"Of"}, "lc,sort");
# calc mode variables
# Approx = "(?:approximately)"
# Exact = "(?:exactly)"
# Business = "(?:business)"
Date_InitStrings($lang{"exact"}, \$Lang{$L}{"Exact"}, "lc,sort");
Date_InitStrings($lang{"approx"}, \$Lang{$L}{"Approx"}, "lc,sort");
Date_InitStrings($lang{"business"},\$Lang{$L}{"Business"},"lc,sort");
############### END OF LANGUAGE INITIALIZATION
}
if ($Curr{"ResetWorkDay"}) {
my($h1,$m1,$h2,$m2)=();
if ($Cnf{"WorkDay24Hr"}) {
($Curr{"WDBh"},$Curr{"WDBm"})=(0,0);
($Curr{"WDEh"},$Curr{"WDEm"})=(24,0);
$Curr{"WDlen"}=24*60;
$Cnf{"WorkDayBeg"}="00:00";
$Cnf{"WorkDayEnd"}="23:59";
} else {
confess "ERROR: Invalid WorkDayBeg in Date::Manip.\n"
if (! (($h1,$m1)=CheckTime($Cnf{"WorkDayBeg"})));
$Cnf{"WorkDayBeg"}="$h1:$m1";
confess "ERROR: Invalid WorkDayEnd in Date::Manip.\n"
if (! (($h2,$m2)=CheckTime($Cnf{"WorkDayEnd"})));
$Cnf{"WorkDayEnd"}="$h2:$m2";
($Curr{"WDBh"},$Curr{"WDBm"})=($h1,$m1);
($Curr{"WDEh"},$Curr{"WDEm"})=($h2,$m2);
# Work day length = h1:m1 or 0:len (len minutes)
$h1=$h2-$h1;
$m1=$m2-$m1;
if ($m1<0) {
$h1--;
$m1+=60;
}
$Curr{"WDlen"}=$h1*60+$m1;
}
$Curr{"ResetWorkDay"}=0;
}
# current time
my($s,$mn,$h,$d,$m,$y,$wday,$yday,$isdst,$ampm,$wk)=();
if ($Cnf{"ForceDate"}=~
/^(\d{4})-(\d{2})-(\d{2})-(\d{2}):(\d{2}):(\d{2})$/) {
($y,$m,$d,$h,$mn,$s)=($1,$2,$3,$4,$5,$6);
} else {
($s,$mn,$h,$d,$m,$y,$wday,$yday,$isdst)=localtime(time);
$y+=1900;
$m++;
}
Date_DateCheck(\$y,\$m,\$d,\$h,\$mn,\$s,\$ampm,\$wk);
$Curr{"Y"}=$y;
$Curr{"M"}=$m;
$Curr{"D"}=$d;
$Curr{"H"}=$h;
$Curr{"Mn"}=$mn;
$Curr{"S"}=$s;
$Curr{"AmPm"}=$ampm;
$Curr{"Now"}=Date_Join($y,$m,$d,$h,$mn,$s);
if ($Cnf{"TodayIsMidnight"}) {
$Curr{"Today"}=Date_Join($y,$m,$d,0,0,0);
} else {
$Curr{"Today"}=$Curr{"Now"};
}
$Curr{"Debug"}=$Curr{"DebugVal"};
# If we're in array context, let's return a list of config variables
# that could be passed to Date_Init to get the same state as we're
# currently in.
if (wantarray) {
# Some special variables that have to be in a specific order
my(@special)=qw(IgnoreGlobalCnf GlobalCnf PersonalCnf PersonalCnfPath);
my(%tmp)=map { $_,1 } @special;
my(@tmp,$key,$val);
foreach $key (@special) {
$val=$Cnf{$key};
push(@tmp,"$key=$val");
}
foreach $key (keys %Cnf) {
next if (exists $tmp{$key});
$val=$Cnf{$key};
push(@tmp,"$key=$val");
}
return @tmp;
}
return ();
}
sub ParseDateString {
print "DEBUG: ParseDateString\n" if ($Curr{"Debug"} =~ /trace/);
=8= |