#!/usr/bin/perl
# This tool reaads a queue_log file and prints it out on standard output at the 
# same pace as the original log file was produced
open( EVENTS, "<$ARGV[0]" );

while (<EVENTS>) {
    chomp;
    my ( @parametros) = split( /\|/, $_ );

    if ($#parametros < 4 ) {
        next;
    }

    my $date       = shift(@parametros);

    if ( $date !~ /^[0-9]/) {
        next;
    }
    if(!defined($savedate)) { $savedate=$date; }
    $sleep = $date-$savedate;
    sleep($sleep);
    $savedate=$date;
    print $_."\n";

}
close(EVENTS);

