🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #75995

Innreport and change of year (problem)

#75995
From: Iulius
Date: Sun, 01 Apr 2007 13:18
66 lines
3348 bytes
Hi,

There is a problem in the name of the last report of each 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 1 04:15:03 ».


The faulty 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...
And I cannot reproduce the problem if I manually give localtime!


Examples of the problem:

http://news.netcologne.de/innreport/stats/ (where there is Jan 1 - Dec 31)
http://talisker.lacave.net/news/innstats/ (where there is no Dec 31 - Jan 1)
(...)


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)
Technical Details
Message-ID: <euobfc$bot$1@guepard.ecp.fr>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!feed.ac-versailles.fr!news.ecp.fr!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <euobfc$bot$1@guepard.ecp.fr>
Subject: Innreport and change of year (problem)
Date: Sun, 01 Apr 2007 15:18:38 +0200
From: Iulius <iulius@nom-de-mon-site.com.invalid>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!feed.ac-versailles.fr!news.ecp.fr!not-for-mail
Newsgroups: news.software.nntp
Organization: Gens Iulia -- http://www.trigofacile.com/
Lines: 66
NNTP-Posting-Host: goret.via.ecp.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
X-Trace: guepard.ecp.fr 1175433576 12061 138.195.145.22 (1 Apr 2007 13:19:36
 GMT)
X-Complaints-To: ingesys@cti.ecp.fr
NNTP-Posting-Date: Sun, 1 Apr 2007 13:19:36 +0000 (UTC)
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)