xref: /glogg/tools/timer.pl (revision 6281910632bfca8f4657ac05caaf18b23b7d39d3)
1*62819106SNicolas Bonnefon#!/usr/bin/perl
2*62819106SNicolas Bonnefon
3*62819106SNicolas Bonnefonuse Time::Local;
4*62819106SNicolas Bonnefon
5*62819106SNicolas Bonnefonwhile (<>) {
6*62819106SNicolas Bonnefon    chomp;
7*62819106SNicolas Bonnefon    print "$_\n";
8*62819106SNicolas Bonnefon    if (/^- (\d*):(\d*):(\d*)\.(\d*) /) {
9*62819106SNicolas Bonnefon        $time = timelocal($3, $2, $1, (localtime)[3,4,5]) + ($4/1000.0);
10*62819106SNicolas Bonnefon        # print "$time\n";
11*62819106SNicolas Bonnefon        if (/DEBUG: Starting the count\.\.\./) {
12*62819106SNicolas Bonnefon            $startcount = $time;
13*62819106SNicolas Bonnefon            print "$startcount\n";
14*62819106SNicolas Bonnefon        }
15*62819106SNicolas Bonnefon        elsif (/DEBUG: \.\.\. finished counting\./) {
16*62819106SNicolas Bonnefon            print "Counting: ",$time-$startcount,"\n";
17*62819106SNicolas Bonnefon        }
18*62819106SNicolas Bonnefon    }
19*62819106SNicolas Bonnefon}
20