Re: Seconds left in day + DST

2008-06-19 Thread Rick Measham
P DD wrote: my $tom = ($now + DateTime::Duration->new(days => 1))->truncate(to => 'day'); Can I suggest this for neater code: my $tom = $dt->clone->add( days => 1 )->truncate( to => 'day' ); Cheers! Rick Measham -- Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and co

Re: Seconds left in day + DST

2008-06-19 Thread P DD
For posterity... or as long as these mailing lists are archived. my $now = DateTime->now(time_zone => 'local'); my $tom = ($now + DateTime::Duration->new(days => 1))->truncate(to => 'day'); my $seconds_left = $tom->subtract_datetime_absolute($now)->seconds; On Thu, Jun 19, 2008 at 1:03 PM, Dave

Re: Seconds left in day + DST

2008-06-19 Thread Dave Rolsky
On Thu, 19 Jun 2008, Jim Spath wrote: I'm a bit unclear on how to properly deal with DST when determining the number of seconds left in a day. Here's what I have now: my $now = DateTime->now(time_zone => 'local'); my $tom = ($dt + DateTime::Duration->new(days => 1))->truncate(to => 'day'));

Seconds left in day + DST

2008-06-19 Thread Jim Spath
I'm a bit unclear on how to properly deal with DST when determining the number of seconds left in a day. Here's what I have now: my $now = DateTime->now(time_zone => 'local'); my $tom = ($dt + DateTime::Duration->new(days => 1))->truncate(to => 'day')); my $seconds_left = $tom_dt->epoch() -

Unsupported intervals

2008-06-19 Thread Brett Gardner
I came across a bug in DateTime::Format::Pg->parse_duration whereby it does not parse the following intervals @ x hours @ y minutes @ z seconds This was frustrating because the format->duration does output these values. Attached is a patch which fixes this behaviour. Cheers, Brett Gardner