We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 802084f commit f001c1dCopy full SHA for f001c1d
1 file changed
hostap_timestamp.pl
@@ -1,5 +1,7 @@
1
#!/usr/bin/perl
2
3
+# Convert LANforge logs and hostapd log timestamps to human readable timestamp.
4
+
5
use POSIX qw( strftime );
6
7
while (<>) {
@@ -12,6 +14,15 @@
12
14
my $dt = strftime("%Y-%m-%d %H:%M:%S", localtime($time_sec));
13
15
print "$dt.$usec_pad $rest\n";
16
}
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
+ }
26
else {
27
print $ln;
28
0 commit comments