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:
Output: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";
I would expect:2011-11-11 14:30:00.1000 UTC
2011-11-11 14:30:01.000 UTC
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Rounding Issue in DateTime strftime?
by runrig (Abbot) on Nov 14, 2011 at 18:23 UTC | |
by SparkeyG (Curate) on Nov 14, 2011 at 19:03 UTC | |
by runrig (Abbot) on Nov 14, 2011 at 19:24 UTC | |
by SparkeyG (Curate) on Nov 14, 2011 at 19:39 UTC | |
by runrig (Abbot) on Jan 27, 2012 at 18:55 UTC |
Back to
Seekers of Perl Wisdom