Hi All,

I have just committed changes to the sunrise module for preserving the
timezone information. I have to confess I do not like how I had to do it :(

Here is how I have changed the _sunrise sub

  my $rise_time = $tmp_dt1 + $rise_dur;
  my $set_time  = $tmp_dt1 + $set_dur;
  my $tz = $dt->time_zone;
  $rise_time->set_time_zone($tz) unless $tz->is_floating;
  $set_time->set_time_zone ($tz) unless $tz->is_floating;
  return ( $rise_time, $set_time );

This will not preserve the class information, I tried Flavio's suggestion of

my $tmp_dt1 = $dt->
         clone->
         set_time_zone( 'UTC' )->
         truncate( to => 'day' );

instead of creating a new object however, I was always getting the incorrect
date returned.

So I reverted back to creating a new object and setting the timezone of the
new object.

Thanks

Ron Hill

Reply via email to