Tim,

As I said in response to your other email, the various next/previous/iterator methods should respect the time zone of the datetime object that you pass to them, so this should work:

 my $cron = DateTime::Event::Cron->from_cron(cron => '* * * * *');
 my $now = DateTime::Event->now(time_zone => 'Europe/Berlin');
 my $next = $cron->next($now);
 # $next will be in time zone Europe/Berlin

Recurrence sets can also be set to a default time zone. For example:

 my $cron = DateTime::Event::Cron->from_cron(cron => '* * * * *');
 my $now = DateTime->now(time_zone => 'local');
 my $lcron = $cron->set_time_zone('Europe/Berlin');
 my $next = $lcron->next($now);
 # $next will be in the Europe/Berlin time zone, even if 'local' was not

I'm reasonably sure that in this last case, the time zone is converted *after* all relevant calculations, so you will not inadvertently miss any recurrence events due merely to a time zone leap.

Cheers,
Matt



Reply via email to