Hi all,
let me make my query independent of now() for the time being.

use DateTime::Event::Cron;

$cron = DateTime::Event::Cron->from_cron(cron => ' 15 18 * * 1-5');
$new_cron = $cron->clone()->set_time_zone('Europe/Berlin');

$date = DateTime->new( year => 2004, month => 6, day => 30,
                       hour => 17,   minute=> 10,
                       time_zone => 'Europe/London');

print $date->strftime("%a %F %T %Z\n");
$date = $date->clone()->set_time_zone('Europe/London');

print $date->strftime("%a %F %T %Z\n");
$next = $new_cron->next($date);
print $next->strftime("%a %F %T %Z\n");


# Let's repeat the same operation as before

$date = DateTime->new( year => 2004, month => 6, day => 30,
                       hour => 17,   minute=> 10,
                       time_zone => 'Europe/London');

print $date->strftime("%a %F %T %Z\n");
$date = $date->clone()->set_time_zone('Europe/Berlin');
print $date->strftime("%a %F %T %Z\n");
$next = $new_cron->next($date);
print $next->strftime("%a %F %T %Z\n");

This gives the following result
Wed 2004-06-30 17:10:00 GMT/BST
Wed 2004-06-30 17:10:00 GMT/BST
Wed 2004-06-30 19:15:00 CEST
Wed 2004-06-30 17:10:00 GMT/BST
Wed 2004-06-30 18:10:00 CEST
Wed 2004-06-30 18:15:00 CEST

I would expect the results to be same if they are expressed in the same time
zone.
My reasoning is the following :
I first define a cron schedule and then set the time zone for this floating
set.
When I request the next scheduled event I expect always to obtain the same
instant time, possibly expressed in different time zone. Unfortunately I get
19:15 CEST and 18:15 CEST. Where am I getting it wrong?

Regards Tim


Reply via email to