On Sun, 22 Aug 2010, Michael G Schwern wrote:
Or you allow fractional durations. 1 day / 1 hour = 1/24th of a day (not 1
hour). Only when it is applied to a fixed datetime does it translate back.
Normally something like "2010-02-10 12:00" would become "2010-02-10 13:00"
when 1/24th of a day is added. But if the date were DST then it would do...
uhh... something I can't quite figure out just now.
What's the point of trying to do this? The result is confusing as hell in
almost every possible case. What's (1 day / 97) for _any_ date?
I'm not sure why the original poster wanted this. The only good use case I
can think of would be when you have a duration of seconds only and you
want to divide it, in which case it's not that hard to do something like:
my $new_dur =
DateTime::Duration->new( seconds => int( $dur->seconds / 25 ) );
Or if you really want to get fancy, you could even turn the fractional
portion into nanoseconds.
I think part of the problem here is that DateTime serves too many masters.
I suspect there's a use for an object that's based on mjd and only uses
seconds for scientific purposes.
-dave
/*============================================================
http://VegGuide.org http://blog.urth.org
Your guide to all that's veg House Absolute(ly Pointless)
============================================================*/