Quoting Dave Rolsky <[EMAIL PROTECTED]>: > > With DateTime::Span: > > > > $mid_point = > > $span->start->add_duration( > > seconds => $span->duration->seconds / 2 > > ); > > > > With DateTime: > > > > $mid_point = > > $start->add_duration( > > seconds => $end->subtract_datetime_absolute( > > $start > > )->seconds / 2 > > ); > > Oh, duh! Why didn't I think of that. That's nice & simple.
If the operator overloads did that sort of thing behind the scene (and yes, with spans also), then it would be nicer and simpler. :) But thanks, Flavio and Dave, for the recipes and dealing with my questions. > > How about a DateTime::Span->midpoint method? > > Let's wait and see if others ask for it. For now, let's just add those > recipes to the faq. Midpoints are compelling, but also arbitrary. I'd like to see the general problem of portioning a span, or the delta between two arbitrary datetimes (expressed as a span or otherwise, transparently), solved in a general way. After all, if "midpoint" is that common, sure, provide a method, but we don't need methods for thirds, quarters, eighths, forty-thirds, etc. Thanks again, Matt (in the Big Easy for a wedding...man I should get some sleep) P.S. Sorry for the wonky quoting in my earlier messages -- I plead inadequate mail client that can't properly convert between markup and plain text.