TIP: Click on subject to list as thread! ANSI
echo: perl
to: All
from: tony summerfelt
date: 2004-01-26 23:56:24
subject: test this code

could somebody test this code on a binkp log file? i'm getting an invalid
date error, the problem seems to be the $moy{$binkdate[2]}. for binkp log
entries in Jan it is 1, but gives the error...if i replace it with a 1, the
code works fine.

i thought i would  be clever and cut down on the code by using the
Date::Calc module, but i hit this brickwall :)

======================================================================
use Date::Calc qw(Delta_DHMS);

$binklog="r:/fidonet/logs/binkd.log";
%moy = ('Jan','1','Feb','2','Mar','3','Apr','4','May','5','Jun','6',
         'Jul','7','Aug','8','Sep','9','Oct','10','Nov','11','Dec','12');

($sec,$min,$hour,$date,$moy,$year,$dow,$doy,$dst)=localtime(time);
$year+=1900;
$moy++;
{at}today=($year, $moy, $date, $hour, $min, $sec);

open (binkd, $binklog) or die "can't open $binklog -- $!";

while()
{
   {at}binkdate=split(" ");
   {at}binktime=split(/:/,$binkdate[3]);
   {at}binkdate=(2004,$moy{$binkddate[2]},$binkdate[1],
              $binktime[0],$binktime[1],$binktime[2]);
   {at}diff=Delta_DHMS({at}binkdate,{at}today);
   print "$diff[0] days, $diff[1]:$diff[2]:$diff[3]\n";
}
=================================================================


--- GoldED/spleen 3.0.1-os1+
* Origin: ventedspleen.dyndns.org (1:261/38.5)
SEEN-BY: 633/267 270
@PATH: 261/38 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.