Skip to content

Commit f001c1d

Browse files
committed
hostap-timestamp can now parse LANforge log timestamps as well.
1 parent 802084f commit f001c1d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

hostap_timestamp.pl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/perl
22

3+
# Convert LANforge logs and hostapd log timestamps to human readable timestamp.
4+
35
use POSIX qw( strftime );
46

57
while (<>) {
@@ -12,6 +14,15 @@
1214
my $dt = strftime("%Y-%m-%d %H:%M:%S", localtime($time_sec));
1315
print "$dt.$usec_pad $rest\n";
1416
}
17+
elsif ($ln =~ /^(\d+): (.*)/) {
18+
my $tot_msec = $1;
19+
my $rest = $2;
20+
my $sec = int($tot_msec / 1000);
21+
my $msec = $tot_msec % 1000;
22+
my $msec_pad = sprintf("%03d", $msec);
23+
my $dt = strftime("%Y-%m-%d %H:%M:%S", localtime($sec));
24+
print "$dt.$msec_pad $rest\n";
25+
}
1526
else {
1627
print $ln;
1728
}

0 commit comments

Comments
 (0)