Innreport problem (change of year)
Julien ÉLIE
julien at trigofacile.com
Mon Jan 8 20:30:05 UTC 2007
Hi,
There is a problem in the name of the last report of the year.
Instead of being named « news-notice.2006.12.31-04.15.02.html »,
it is named « news-notice.2006.01.01-00.00.00.html » and thus,
breaks everything in the html page (it is put at the bottom...).
And the line is « Jan 1 00:00:00 -- Dec 31 23:59:59 » instead of
« Dec 31 04:15:02 -- Jan 2 04:15:03 ».
The code is:
if ($HTML) {
# Create a new filename (unique and _sortable_)
if ($ARCHIVE) {
# The filename will contain the first date of the log or the current time.
my ($ts, $tm, $th, $dd, $dm, $dy) = localtime;
my ($m, $d, $h, $mn, $s) =
$first_date =~ /^(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)$/;
if ($m) {
my $ddm = (index "JanFebMarAprMayJunJulAugSepOctNovDec", $m) / 3;
# Adjust the year because syslog doesn't record it. We assume that
# it's the current year unless the last date is in the future.
my $ld = &ConvDate($last_date);
$dy-- if $ld > $ts + 60 * ($tm + 60 * ($th + 24 * ($dd - 1 +
substr("000031059090120151181212243273304334", $dm * 3, 3)))) ||
$ld < &ConvDate($first_date);
($dm, $dd, $th, $tm, $ts) = ($ddm, $d, $h, $mn, $s);
}
$dm++; # because January = 0 and we prefer 1
$dy += 100 if $dy < 90; # Try to pacify the year 2000 !
$dy += 1900;
$suffix = sprintf ".%02d.%02d.%02d-%02d$SEPARATOR%02d$SEPARATOR%02d",
$dy, $dm, $dd, $th, $tm, $ts;
}
else {
$suffix = '';
}
$HTML_output = "$HTML_dir" . "/news-notice" . "$suffix" . ".html";
[...]
I do not know why ($d, $h, $mn, $s) is (0, 0, 0, 0) in the assignment.
It shouldn't...
Examples of the problem:
http://news.netcologne.de/innreport/stats/
http://talisker.lacave.net/news/innstats/
(...)
By the way, is the « 000031059090120151181212243273304334 » right for
bissextile years?
Regards,
--
Julien
« -- Mais puisque je vous dis que je ne suis pas entré dans
cette piscine de mon plein gré !
-- Ce n'est pas une raison, espèce de dégoûtant pour ne pas
enlever vos sandales !!! » (Astérix)
More information about the inn-bugs
mailing list