On 2/12/04 1:36 PM, Dave Rolsky wrote: > On Tue, 10 Feb 2004, John Siracusa wrote: >> On 2/10/04 12:17 PM, Dave Rolsky wrote: >>> I should add a section to the docs on this so that people know what to >>> expect. >> >> Yes, please do, because I am eternally confused by this :) > > There are some docs already, in DateTime.pm, under the header "How Date > Math is Done" > > Are those insufficient? There's a pointer to that section in > DateTime::Duration's DESCRIPTION header.
I was thinking more along the lines of an explanation of why the example below doesn't work as expected, and how to do a few things that you "might be trying to do." On 2/10/04 12:09 PM, Mark Fowler wrote: > use DateTime::Duration; > my $dur = DateTime::Duration->new(hours => 2); > print $dur->hours . ":" . > $dur->minutes . ":" . > $dur->seconds . "\n"; > > print $dur->delta_minutes . ":" . > $dur->delta_seconds . "\n"; > > Prints: > > 2:0:0 > 120:0 > > Shouldn't that print > > 2:0:0 > 120:7200 > > Or am I being really stupid? Basically, something like your reply to the list, but in POD form :) I'm not saying turn the docs into a cookbook, but this area really is "non-obvious" to people who haven't spent a long time thinking about date math (i.e. "most people" :) Yeah, you can derive the answers by reading the existing docs (or the code ;), but some hand-holding is nice once in a while. -John
