Code:
#!/usr/bin/perl
use Time::Local;
while (<>) {
@f = split /\|/, $_;
($y1, $o1, $d1) = (substr($f[3], 0, 4), substr($f[3], 5, 2), substr($f[3], 8, 2));
($h1, $m1, $s1) = (substr($f[3], 11, 2), substr($f[3], 14, 2), substr($f[3], 17, 2));
$ms1 = substr($f[3], 20, 3);
($y2, $o2, $d2) = (substr($f[4], 0, 4), substr($f[4], 5, 2), substr($f[4], 8, 2));
($h2, $m2, $s2) = (substr($f[4], 11, 2), substr($f[4], 14, 2), substr($f[4], 17, 2));
$ms2 = substr($f[4], 20, 3);
$t2 = timelocal($s2, $m2, $h2, $d2, $o2-1, $y2-1900);
$t1 = timelocal($s1, $m1, $h1, $d1, $o1-1, $y1-1900);
printf("t2=%d.%03d\tt1=%d.%03d\tt2-t1=%g\n", $t2, $ms2, $t1, $ms1, ($t2-$t1) + (($ms2-$ms1)/1000));
}