Skip to content
Snippets Groups Projects
Commit 10d59809 authored by Robert Anderson's avatar Robert Anderson
Browse files

Convert to timestamp supported by database

parent a3874477
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ use smradius::dblayer; ...@@ -27,6 +27,7 @@ use smradius::dblayer;
use smradius::logging; use smradius::logging;
use smradius::util; use smradius::util;
use DateTime;
use POSIX qw(ceil); use POSIX qw(ceil);
use Data::Dumper; use Data::Dumper;
...@@ -269,6 +270,12 @@ sub acct_log ...@@ -269,6 +270,12 @@ sub acct_log
foreach my $attr ($packet->attributes) { foreach my $attr ($packet->attributes) {
$template->{'accounting'}->{$attr} = $packet->rawattr($attr) $template->{'accounting'}->{$attr} = $packet->rawattr($attr)
} }
# Fix up timestamp a bit
$template->{'accounting'}->{'Event-Timestamp-Unix'} = $template->{'accounting'}->{'Event-Timestamp'};
my $dt = DateTime->from_epoch( epoch => $template->{'accounting'}->{'Event-Timestamp'} );
$template->{'accounting'}->{'Event-Timestamp'} = $dt->strftime('%Y-%m-%d %H:%M:%S');
$template->{'user'} = $user; $template->{'user'} = $user;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment