PERL:



PERL: - . 113


$d1 = ParseDate( Tue, 26 May 1998 23 57 38 -0400 ),

$d2 = ParseDate( Wed, 27 May 1998 05 04 03 +0100 ),

print DateCalc($d1, $d2),

+0:0.0:0:0:6:25

, , - . hopdelta 3.1 () . ­ .

1.3. hopdelta

tt'/usr/bin/perl

# hopdelta -


3.11. : hopdelta 111

U

use strict

use Date Manip qw (ParseDate UnixDate),

# , - printf

#  format/write

printf %-20 20s %-20 20s 96-20 20s %s\n ,

Sender , Recipient , Time , Delta ,
$/ = #

$_ =  #

s/\n\s+/ /g,

# ,
my($start_from) = /"From *\@(["\s>])/m,
my($start_date) = /"Date \s+( *)/m,

my $then = getdate($start_date),

printf %-20 20s %-20 20s %s\n , Start , $start_from, fmtdate($then)

my $prevfrom = $start_from

#
for (reverse split(/\n/)) {

my ($delta, $now, $from, $by, $when),

next unless /"Received /

s/\bon ( *?) (id *)/, $1/s, n , qmail

unless (($when) = / \s+( *)$/) { # where the date falls

warn bad received line $_ ,

next

($from) = /from\s+(\S+)/,

($from) = /\(( *9)\)/ unless $from #

$from =~ s/\)$//, -

($by) = /by\s+(\S+\ \S+)/ #

# , for ($when) {

s/ (for|via) *$//,

s/([+-]\d\d\d\d) \(\S+\)/$V,

s/id \S+,VW/.

next unless $now = getdate($when), tt