Hi Flavio & Dave, > > Dave Rolsky wrote: > > > > On Wed, 24 Sep 2003, Flavio S. Glock wrote: > > > > > sub _following_sunrise { > > > [ ... initialize ...] > > > my $tz = $dt->time_zone; > > > my $loc = $dt->locale; > > > [ ... some calculations ... ] > > > $tmp_rise->set_time_zone( $tz ); # unless > $tz->is_floating ??? > > > $tmp_rise->set_locale( $loc ); > > > return $tmp_rise; > > > } > > > > It's probably ok to set the time zone even if the given DT is in the > > floating time zone. > > No, converting from UTC to floating would give the same "unexpected" > results. > > How about adding ( localtime - gmtime ) before converting to floating?
I think we are making this harder that it needs to be. First off, do you think it would be better to add these things in the _sunrise subroutine? This is where I have created the new DT object. my $rise_dur = DateTime::Duration->new( hours => $hour_rise, minutes => $min_rise); my $set_dur = DateTime::Duration->new( hours => $hour_set, minutes => $min_set); my $tmp_dt1 = DateTime->new( year => $dt->year, month => $dt->month, day => $dt->day, hour => 0, minute => 0, time_zone => 'UTC' ); my $rise_time = $tmp_dt1 + $rise_dur; my $set_time = $tmp_dt1 + $set_dur; return ( $rise_time, $set_time ); I would set the time zone after I have added/subtractd the duration to get the rise/set times. As for floating time zones I say leave it at UTC and document it. just my 2 cents!! Ron Hill