Subject: | Missing nanosecond information |
I'm replacing an older time conversion module use where I work with
calls to DateTime. I noticed that when converting from MJD to a
calendar date using DateTime::Format::Epoch::MJD that the seconds value
in $dt->hms is truncated where the old module rounded the seconds. Not
a problem, I figured. I can just get $dt->fractional_second and do the
rounding myself to replicate the existing behavior. However, I found
that there is no nanosecond information in the formatter object returned
by DateTime::Format::Epoch::MJD.
Looking at parse_datetime Epoch.pm, I can see that $delta_nano is
calculated but nothing is done with it. I added "rd_nanosecs =>
$delta_nano" to the $temp_dt object and "$self->{rd_nanosecs}" to
DateTime::Format::Epoch::_DateTime::utc_rd_values.
I don't know if this is a complete and correct fix, but now
$dt->fractional_second returns what I expect. Could you make sure to
add the nanosecond information into the object in future revisions?