Revome the call to date and iconv system command each time a HTML file is genrated, call it just one time if directive Locale is defined at initialisation. Thanks to ammdispose for the report.

This commit is contained in:
Darold Gilles 2013-05-17 19:48:45 +02:00
parent 7b22d55fec
commit 1466dd37c1

View File

@ -497,6 +497,14 @@ sub _init
# Override verbose mode
$self->{QuietMode} = 0 if ($debug);
# Enable local date format if defined, else strftime will be used. The limitation
# this behavior is that all dates in HTML files will be the same for performences reasons.
if ($self->{Locale}) {
my $lang = 'LANG=' . $self->{Locale};
$self->{start_date} = `$lang date | iconv -t $Translate{CharSet} 2>/dev/null`;
chomp($self->{start_date});
}
# Get the last parsing date for incremental parsing
if (-e "$self->{Output}/SquidAnalyzer.current") {
my $current = new IO::File;
@ -1094,13 +1102,7 @@ sub _print_header
{
my ($self, $fileout, $menu, $calendar, $sortpos) = @_;
my $lang = '';
if ($self->{Locale}) {
$lang = 'LANG=' . $self->{Locale};
}
my $curdate = `$lang date | iconv -t $Translate{CharSet} 2>/dev/null`;
chomp($curdate);
my $now = $curdate || strftime("%a %b %e %H:%M:%S %Y", localtime);
my $now = $self->{start_date} || strftime("%a %b %e %H:%M:%S %Y", localtime);
$sortpos ||= 2;
print $$fileout qq{