On Wed, 15 Jun 2005, Rick Measham wrote:
renard wrote:
I quote from perldoc DateTime:
"DateTime.pm" always adds (or subtracts) days, then months, minutes, and
then seconds. If there are any boundary overflows, these are normalized
at each step.
Dave, if you're following this, can you tell me if there's a reason why you
do this mixed up order?
I think it was just easiest ;)
P.S. Dave, Here's quick hacks of the two functions I'd like to see added ...
there's no checking that we really have a duration or anything like that...
sub add_lsb {
my ($self, $duration) = @_;
foreach (qw/nanosecond second minute hour day month year/) {
$self->add( $_ => $duration->$_ ) if $duration->$_
}
return $self;
}
sub add_msb {
my ($self, $duration) = @_;
foreach (reverse qw/nanosecond second minute hour day month year/) {
$self->add( $_ => $duration->$_ ) if $duration->$_
}
return $self;
}
I really don't want to clutter up the DateTime API any more than it
already is. I think we need some sort of mixin or wrapper namespace like
we've talked about before.
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/