Skip to content

Commit

Permalink
better regex with list of month instead of \w{3}
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonéri Le Bouder committed Jul 12, 2012
1 parent f868d5f commit 33b9b5d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/FusionInventory/Agent/Tools/Unix.pm
Expand Up @@ -288,6 +288,8 @@ sub getProcessesFromPs {
my $time = $10;
my $cmd = $11;

my $emailPattern = join ('|', keys %month);

# try to get a consistant time format
my $begin;
if ($started =~ /^(\d{1,2}):(\d{2})/) {
Expand All @@ -297,12 +299,12 @@ sub getProcessesFromPs {
# Sat03PM
my $start_day = $2;
$begin = sprintf("%04d-%02d-%02d %s", $year, $month, $start_day, $time);
} elsif ($started =~ /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(\d{2})/) {
} elsif ($started =~ /^($emailPattern)(\d{2})/) {
# Apr03
my $start_month = $1;
my $start_day = $2;
$begin = sprintf("%04d-%02d-%02d %s", $year, $month{$start_month}, $start_day, $time);
} elsif ($started =~ /^(\d{1,2})(\w{3})\d{1,2}/) {
} elsif ($started =~ /^(\d{1,2})($emailPattern)\d{1,2}/) {
# 5Oct10
my $start_day = $1;
my $start_month = $2;
Expand Down

0 comments on commit 33b9b5d

Please sign in to comment.