On Tue, 6 Sep 2005, Rick Measham wrote:

So, assuming America/Chicago: (2003-12-01) - (2003-09-01) will return a duration representing 2 months, 29 days and 23 hours?

Yes, _but_ the docs suggest that if you don't like this you probably wanted _date_ math (not datetime) in the first place, and you can use delta_md(), which will return 3 months.


If so, I'd prefer it returned a duration object representing n seconds ...

THEN I'd like to see another 'local difference' function that worked down from years ..
2003 - 2003 = 0 years
 12 -   09 = 3 months
 01 -   01 = 0 days

(extending .. (2004-01-23) - (2003-09-01) becomes:

2004 - 2003 =  1 year   \    auto normalises    /  0 years
 01 -   09 = -8 months  >--  to get rid of  --<   4 months
 23 -   01 = 22 days   /    negative values    \ 22 days

)

Examples that are date only are pretty meaningless. You can already get the results you're suggesting with the delta_md() method. The complication is when you add in times to the mix. Once you do that it gets really messy, especially if you're trying to produce a duration that consists of all positive or negative deltas.

Then again, I wonder if durations shouldn't be removed altogether and put into separate packages that allowed people to choose their math assumptions.

You always suggest splitting it up into more packages, but that doesn't necessarily help. I think the real problem here is that a lot of people just want date math, and they don't care about times. The real split should probably be a date-only module vs a date+time module.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

Reply via email to