diff --git a/lib/NGCP/Schema/InflateColumn/DateTime/EpochMicro.pm b/lib/NGCP/Schema/InflateColumn/DateTime/EpochMicro.pm index db44339b..49d1d95c 100644 --- a/lib/NGCP/Schema/InflateColumn/DateTime/EpochMicro.pm +++ b/lib/NGCP/Schema/InflateColumn/DateTime/EpochMicro.pm @@ -43,7 +43,7 @@ sub _deflate_from_datetime { unless $info->{data_type} eq "decimal" || (exists $info->{inflate_datetime} && $info->{inflate_datetime} eq 'epoch_micro'); - return $value->epoch; + return $value->hires_epoch; } 1; diff --git a/lib/NGCP/Schema/InflateColumn/DateTime/EpochMilli.pm b/lib/NGCP/Schema/InflateColumn/DateTime/EpochMilli.pm index 22dab7ae..b981bf97 100644 --- a/lib/NGCP/Schema/InflateColumn/DateTime/EpochMilli.pm +++ b/lib/NGCP/Schema/InflateColumn/DateTime/EpochMilli.pm @@ -43,7 +43,7 @@ sub _deflate_from_datetime { unless $info->{data_type} eq "decimal" || (exists $info->{inflate_datetime} && $info->{inflate_datetime} eq 'epoch_milli'); - return $value->epoch; + return $value->hires_epoch; } 1; diff --git a/lib/NGCP/Schema/Result/events.pm b/lib/NGCP/Schema/Result/events.pm index 644a5a85..ca1480cb 100644 --- a/lib/NGCP/Schema/Result/events.pm +++ b/lib/NGCP/Schema/Result/events.pm @@ -8,6 +8,7 @@ our $VERSION = '2.007'; __PACKAGE__->load_components( "InflateColumn::DateTime", "Helper::Row::ToJSON", + "+NGCP::Schema::InflateColumn::DateTime::EpochMilli", ); __PACKAGE__->table("accounting.events"); @@ -31,7 +32,7 @@ __PACKAGE__->add_columns( "new_status", { data_type => "varchar", is_nullable => 0, size => 255 }, "timestamp", - { data_type => "decimal", is_nullable => 0, size => [13, 3] }, + { data_type => "decimal", is_nullable => 0, size => [13, 3], inflate_datetime => 'epoch_milli' }, "export_status", { data_type => "enum", @@ -49,6 +50,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); + sub TO_JSON { my ($self) = @_; return {