use strict;
use warnings;
if ($#ARGV != 0) { die "Give the VirtualBox log file in the command line\n"; }
# extract log timestamp from VBox.log
my $line = 0;
my $continuation = 0;
while (<LOG>)
{
chomp;
$line++;
last;
}
# compute perl time value corresponding to timestamp
$frac = "0.$frac";
}
else
{
die "Timestamp $start cannot be parsed\n";
}
# print entire log with absolute timestamps in local time
my $firstrel;
# Note that for continuations we're slightly inaccurate, as we have no idea
# about the time difference between the start of the process and the start of
# logging as documented by the timestamp. Usually a couple milliseconds.
while (<LOG>)
{
# msec rounding paranoia
printf("%04d-%02d-%02d %02d:%02d:%02d.%03d %s\n", $year + 1900, $mon + 1, $mday, $hour, $min, $sec, $ms, $msg);
}
close(LOG);