On Sun, 27 Jul 2003, Joshua Hoblitt wrote:
> > A while ago I proposed a patch that would add rd_nanosecs to the
> > return values from utc_r_values(). If I recall correctly, I was
> > supposed to update the calendar dev docs before applying the patch.
> > This would avoid the need for every calendar to have a nanoseconds
> > method like DT. IMHO thats a lot better then a bunch of calls to
> > can(). Maybe I should get around to doing that... :)
> >
> > The thread subject was "utc_rc_values nanosecond support"
>
> Here is the patch I had proposed.
I think I should apply this.
Why don't you go ahead and update the calendar dev docs too. Since if
nothing is returned for nanoseconds it'll be zero (well, undef), the
transition shouldn't be a problem
> 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} }
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/