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() - $dt->epoch();

It seems to work fine, but another developer here mentioned that it might not handle DST properly, although he wasn't sure how to do it himself.

I'd like it to return the number of seconds until the next day, in my local timezone (EST).

Thanks!
- Jim

Reply via email to