Re: DT::Duration overloads

2004-06-10 Thread Dave Rolsky
On Thu, 10 Jun 2004, Matt Sisk wrote: What I'd like to do is simply find the midpoint, more or less, between two arbitrary datetimes. Off the cuff, knowing nothing about the internals (which I do, but I'm pretending not to) I'd think this: $mid = $dt1 + ($dt2 - $dt1)/2 to dwim.

Re: DT::Duration overloads

2004-06-10 Thread Dave Rolsky
On Thu, 10 Jun 2004, Matt Sisk wrote: What I'd like to do is simply find the midpoint, more or less, between two arbitrary datetimes. Off the cuff, knowing nothing about the internals (which I do, but I'm pretending not to) I'd think this: Also, I'd like to point out that this really doesn't

Re: DT::Duration overloads

2004-06-10 Thread Matt Sisk
Dave Rolsky wrote: Well, if you just want the _date_, it's pretty easy. my $dur = $dt1-delta_days($dt2); # or use Math::Round if you want my $mid = $dt1-add( days = int( $dur-delta_days / 2 ) ); If you want to account for the time then it gets funkier. Hmm, indeed. I need to approximate solar noon

Re: DT::Duration overloads

2004-06-10 Thread Matt Sisk
Dave Rolsky wrote: Also, I'd like to point out that this really doesn't have as much to do with the internals as it does with the nature of date time math. You cannot expect to understand date math without understanding that it's not possible to convert between various units of date/time, in

DateTime::Calendar::Discordian

2004-06-10 Thread Jaldhar H. Vyas
While malingering from actual work, I wrote some code to convert dates to and from the Discordian calendar. Over the past couple of nights I made it into a proper DateTime::Calendar module which I posted to PerlMonks (http://www.perlmonks.org/index.pl?node_id=362936) This morning I also packaged

Re: DateTime::Calendar::Discordian

2004-06-10 Thread Dave Rolsky
On Thu, 10 Jun 2004, Jaldhar H. Vyas wrote: While malingering from actual work, I wrote some code to convert dates to and from the Discordian calendar. Over the past couple of nights I made it into a proper DateTime::Calendar module which I posted to PerlMonks

Re: DateTime::Calendar::Discordian

2004-06-10 Thread Jaldhar H. Vyas
On Thu, 10 Jun 2004, Dave Rolsky wrote: Well, Rich Bowen had started working on the same module, so you should talk to him. Reviewing the code/docs, I have a couple nits: Oh yeah I just saw that in the list archives. - The constructor shouldn't take rd_secs, rd_nanosecs, or locale, I don't

Re: DT::Duration overloads

2004-06-10 Thread fglock
Matt Sisk wrote: what is the midpoint of a span? 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(

Re: DT::Duration overloads

2004-06-10 Thread Dave Rolsky
On Thu, 10 Jun 2004 [EMAIL PROTECTED] wrote: Matt Sisk wrote: what is the midpoint of a span? With DateTime::Span: $mid_point = $span-start-add_duration( seconds = $span-duration-seconds / 2 ); With DateTime: $mid_point = $start-add_duration( seconds

ANNOUNCE: DateTime.pm 0.2101

2004-06-10 Thread Dave Rolsky
0.2101 2004-06-10 - There was a bug in the date math code that occurred if you tried to add enough days, minutes or seconds to generate a datetime 10 years in the future (or so). If the the DateTime object had a a time zone with recurring DST changes, then the date math operation would cause a

Re: Re: DT::Duration overloads

2004-06-10 Thread Rick Measham
On Thu, 10 Jun 2004 [EMAIL PROTECTED] wrote: How about a DateTime::Span-midpoint method? On 11 Jun 2004, at 6:55 AM, Dave Rolsky replied: Let's wait and see if others ask for it. For now, let's just add those recipes to the faq. I'm not sure of the best namespace, but I can see a Util namespace

Re: Re: DT::Duration overloads

2004-06-10 Thread Bruce Van Allen
On 6/11/04 Rick Measham wrote: On Thu, 10 Jun 2004 [EMAIL PROTECTED] wrote: How about a DateTime::Span-midpoint method? On 11 Jun 2004, at 6:55 AM, Dave Rolsky replied: Let's wait and see if others ask for it. For now, let's just add those recipes to the faq. I'm not sure of the best