From: Luca Ferrari Date: Fri, 24 May 2019 13:02:39 +0000 (+0200) Subject: Fix fractional seconds in all begin and end parameters. X-Git-Tag: v11.0~23^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67b7db0339daa6d92ec65c795a1059f77cec9340;p=pgbadger Fix fractional seconds in all begin and end parameters. --- diff --git a/pgbadger b/pgbadger index a1ca87b..f635221 100755 --- a/pgbadger +++ b/pgbadger @@ -892,14 +892,14 @@ if ($from) { if ( $from =~ /^(\d{2}):(\d{2}):(\d{2})([.]\d+([+-]\d+)?)?$/) { # only time, trick around the date part my $fractional_seconds = $4 || "0"; - $from_hour = "$1:$2:$3.$4"; + $from_hour = "$1:$2:$3.$fractional_seconds"; &logmsg('DEBUG', "Setting begin time to [$from_hour]" ); } elsif( $from !~ /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})([.]\d+([+-]\d+)?)?$/ ) { localdie("FATAL: bad format for begin datetime, should be yyyy-mm-dd hh:mm:ss.l+tz\n"); } else { my $fractional_seconds = $7 || "0"; - $from = "$1-$2-$3 $4:$5:$6.$7" + $from = "$1-$2-$3 $4:$5:$6.$fractional_seconds" } } @@ -908,14 +908,14 @@ if ($to) { if ( $to =~ /^(\d{2}):(\d{2}):(\d{2})([.]\d+([+-]\d+)?)?$/) { # only time, trick around the date part my $fractional_seconds = $4 || "0"; - $to_hour = "$1:$2:$3.$4"; + $to_hour = "$1:$2:$3.$fractional_seconds"; &logmsg('DEBUG', "Setting end time to [$to_hour]" ); } elsif( $to !~ /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})([.]\d+([+-]\d+)?)?$/) { localdie("FATAL: bad format for ending datetime, should be yyyy-mm-dd hh:mm:ss.l+tz\n"); } else { my $fractional_seconds = $7 || "0"; - $to = "$1-$2-$3 $4:$5:$6.$7" + $to = "$1-$2-$3 $4:$5:$6.$fractional_seconds" } } if ($from && $to && ($from gt $to)) {