Tim,
My understanding with the current behavior is that if you set the time_zone for the set, that time zone will override the time zone of a datetime argument. Probably the easiest thing for you to do is to *not* set the time_zone of the set (since, as was previously discussed, it is actually a factory method rather than a mutator). Instead, just rely on setting the time zone of the original datetime. Using your example as a starting point, try this:
---
use Datetime; use DateTime::Event::Cron;
$cron = DateTime::Event::Cron->from_cron(cron => ' 15 18 * * 1-5');
$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");
$next = $cron->next($date);
print $next->strftime("%a %F %T %Z\n");---
Produces:
Wed 2004-06-30 17:10:00 GMT/BST Wed 2004-06-30 18:15:00 GMT/BST
---
This be what you expect -- namely, each new datetime produced by next() will retain the time zone of the provided argument -- in this case, 'Europe/London'.
The conversation regarding time zones and sets was rather scattered. I think in this case it might have obscured the most straightforward answer to your original question.
Cheers, Matt
