lestrrat-p5 / DateTime-Format-Pg

Other
2 stars 5 forks source link

Nanoseconds should be treated as integer value #14

Closed ichesnokov closed 3 years ago

ichesnokov commented 7 years ago

Some values, e.g. 0.254182 are represented in Perl as0.2541820000000000190354399. When such values are stored in PostgreSQL and then fetched and converted to DateTime object with DateTime::Format::Pg, DateTime object contains the floating point nanosecond value, in this example 254182000.0000000298023223876953125, which leads to problems with DateTime comparison later.

I think DateTime::Format::Pg should convert nanoseconds to an integer value, i.e. _fix_nanosecond should round the result to avoid such problem.