Dave,

I think you probably never got the original email with this patch (it was sent while 
you reported having difficulties).  The general idea was to do something like the 
following and then update the calendar docs so nanosecond precision is always 
preserved in a conversion.

Changes like this should probably wait until after the next release of DT because of 
the strptime/dt validation issue that needs fixing.

-J

--

Index: lib/DateTime.pm
===================================================================
RCS file: /cvsroot/perl-date-time/modules/DateTime.pm/lib/DateTime.pm,v
retrieving revision 1.207
diff -u -r1.207 DateTime.pm
--- lib/DateTime.pm     13 Jun 2003 18:24:16 -0000      1.207
+++ lib/DateTime.pm     19 Jun 2003 06:24:57 -0000
@@ -383,17 +383,15 @@

     my $object = delete $p{object};

-    my ( $rd_days, $rd_secs ) = $object->utc_rd_values;
+    my ( $rd_days, $rd_secs, $rd_nanosecs ) = $object->utc_rd_values;

     my %args;
     @args{ qw( year month day ) } = $class->_rd2ymd($rd_days);
     @args{ qw( hour minute second ) } = $class->_seconds_as_components($rd_secs);
+    $args{ nanoseconds } = $rd_nanosecs;

     my $new = $class->new( %p, %args, time_zone => 'UTC' );

-    $new->set( nanosecond => $object->nanosecond )
-        if $object->can('nanosecond');
-
     $new->set_time_zone( $object->time_zone )
         if $object->can('time_zone');

@@ -693,7 +691,7 @@

 sub language { $_[0]->{language} }

-sub utc_rd_values { @{ $_[0] }{ 'utc_rd_days', 'utc_rd_secs' } }
+sub utc_rd_values { @{ $_[0] }{ 'utc_rd_days', 'utc_rd_secs', 'rd_nanosecs' } }

 # NOTE: no nanoseconds, no leap seconds
 sub utc_rd_as_seconds   { ( $_[0]->{utc_rd_days} * 86400 ) + $_[0]->{utc_rd_secs} }


Reply via email to