Skip to content

Commit

Permalink
Illustrate error in conversion of some floating-point values to nanos…
Browse files Browse the repository at this point in the history
…econds
  • Loading branch information
ichesnokov committed May 4, 2017
1 parent 09c4de1 commit 957b687
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions t/parse_datetime5.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use Test::More tests => 1;
use DateTime::Format::Pg 0.02;

# This test fails when nanosecond is not converted properly to an integer. This
# happens when the fractional part of timestamp is .254182 - got this number by
# experiment.
{
my $dt = DateTime::Format::Pg->parse_datetime('2017-05-02 12:39:10.254182+00');
cmp_ok($dt->nanosecond(), '==', 254182000, 'nanosecond as a number');
}

0 comments on commit 957b687

Please sign in to comment.