use strict;
use Getopt::Std;
+use Date::Parse;
use Date::Format;
use Text::CSV_XS;
use DBI qw( :sql_types );
#skip blank records
next unless grep defined($_), values %dbhash;
+ my $date = time2str( '%Y-%m-%d %X', str2time( $hash{'Date'} ) );
+
$hash{'Status-Type'} = $status_type{ $hash{'Status-Type'} }
if exists $status_type{ $hash{'Status-Type'} };
if ( $hash{'Status-Type'} eq 'Start' ) {
push @keys, 'AcctStartTime';
- $dbhash{'AcctStartTime'} = $hash{'Date'};
+ $dbhash{'AcctStartTime'} = $date;
$sql = 'INSERT INTO radacct ( '. join(',', @keys).
' ) VALUES ( '. join(',', map ' ? ', @keys ). ' )';
my $AcctSessionId = delete($dbhash{AcctSessionId});
push @keys, 'AcctStopTime';
- $dbhash{'AcctStopTime'} = $hash{'Date'};
+ $dbhash{'AcctStopTime'} = $date;
push @extra_values, $AcctSessionId;