#!/mit/perl5/bin/perl -w

use strict;

open(IN, $ARGV[0]) || die "Can't open '$ARGV[0]' for reading!\n";
my ($month, $day, $hour, $minute, $sec, $msec, $event);

my @CAL=("", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
	 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");

my $GMT_DELTA="-0400";
my $GMT_SHIFT=-4;

print "<data>\n";

while(<IN>) {
    chomp;
    m!^(\d+)/(\d+) (\d+):(\d+):(\d+)\.(\d+)  (.+)$!;
    $month=$1;
    $day=$2;
    $hour=$3+$GMT_SHIFT;
    $minute=$4;
    $sec=$5;
    $msec=$6;
    $event=$7;
    next if $event=~/fail/;
    next if $event=~/fades/;
    print "  <event start=\"$CAL[$month] $day 2007 $hour:$minute:$sec GMT\"\n";
    print "    title=\"$event\">\n$event  msec=$msec\n</event>\n";
}
close(IN);
print "</data>\n";
