---
lib/DateTime.pm | 2 +-
t/13strftime.t | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/DateTime.pm b/lib/DateTime.pm
index 8e717e5..f309ffc 100644
--- a/lib/DateTime.pm
+++ b/lib/DateTime.pm
@@ -1304,7 +1304,7 @@ sub _format_nanosecs {
if ( $self->{rd_nanosecs} ) {
my $divide_by = 10**( 9 - $precision );
- return round( $self->{rd_nanosecs} / $divide_by );
+ return sprintf("%0${precision}u", round( $self->{rd_nanosecs} / $divide_by ));
}
else {
return '0' x $precision;
diff --git a/t/13strftime.t b/t/13strftime.t
index 41ac1e9..0b7e5bc 100644
--- a/t/13strftime.t
+++ b/t/13strftime.t
@@ -187,7 +187,7 @@ done_testing();
# %Oy XCIX
__DATA__
-year => 1999, month => 9, day => 7, hour => 13, minute => 2, second => 42, nanosecond => 123456789
+year => 1999, month => 9, day => 7, hour => 13, minute => 2, second => 42, nanosecond => 012345678
%y => '99'
%Y => '1999'
%% => '%'
@@ -207,10 +207,10 @@ year => 1999, month => 9, day => 7, hour => 13, minute => 2, second => 42, nanos
%l => ' 1'
%m => '09'
%M => '02'
-%N => '123456789'
-%3N => '123'
-%6N => '123457'
-%10N => '1234567890'
+%N => '012345678'
+%3N => '012'
+%6N => '012346'
+%10N => '0123456780'
%p => 'PM'
%r => '01:02:42 PM'
%R => '13:02'
--
1.7.1