http://qs321.pair.com?node_id=937996

SparkeyG has asked for the wisdom of the Perl Monks concerning the following question:

I think I found a bug in DateTime's strftime. If you have a nanosecond value that rounds up to a full second, it returns instead a tenth of a second. Pls see the example code and output for details. Am I seeing this correctly? If so I will submit a bug to the maintainers. Sample Code:
use strict; use warnings; use DateTime; use DateTime::Format::Strptime; my $val = "2011-11-11 14:30:00.999981"; my $format = new DateTime::Format::Strptime( pattern => '%F %T.%N', time_zone => 'GMT', ); my $date = $format->parse_datetime($val); print $date->strftime("%F %T.%3N %Z")."\n";
Output:
2011-11-11 14:30:00.1000 UTC
I would expect:
2011-11-11 14:30:01.000 UTC