Hi Ron,
Here is a 'eating our own dog food' patch against Astro::Sunrise 0.8. :)
Cheers,
-J
--
diff -ur Astro-Sunrise-0.8/Makefile.PL Astro-Sunrise-0.8.new/Makefile.PL
--- Astro-Sunrise-0.8/Makefile.PL 2003-02-27 05:05:20.000000000 -1000
+++ Astro-Sunrise-0.8.new/Makefile.PL 2003-08-06 19:02:35.000000000 -1000
@@ -4,5 +4,5 @@
WriteMakefile(
'NAME' => 'Astro::Sunrise',
'VERSION_FROM' => 'Sunrise.pm', # finds $VERSION
- 'PREREQ_PM' =>{ 'Time::Piece' => 1.08, },
+ 'PREREQ_PM' =>{ 'DateTime' => 0.16, },
);
diff -ur Astro-Sunrise-0.8/Sunrise.pm Astro-Sunrise-0.8.new/Sunrise.pm
--- Astro-Sunrise-0.8/Sunrise.pm 2003-02-27 05:10:32.000000000 -1000
+++ Astro-Sunrise-0.8.new/Sunrise.pm 2003-08-06 19:10:29.000000000 -1000
@@ -82,7 +82,7 @@
use POSIX;
use Math::Trig;
use Carp;
-use Time::Piece;
+use DateTime;
#use Time::Seconds;
use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK $RADEG $DEGRAD );
@@ -579,20 +579,16 @@
my $alt = shift || -0.833;
my $offset = int( shift || 0 );
- my $today = localtime;
- #
- # Not sure why appending a 'D' to the offset didn't work. So converted
- # the days into seconds...
- #
- $today = $today + $offset * 86400;
+ my $today = DateTime->today->set_time_zone( 'local' );
+ $today->add( days => $offset );
my( $sun_rise, undef ) = sunrise( $today->year, $today->mon, $today->mday,
$longitude, $latitude,
- $today->tzoffset->hours,
+ ( $today->offset / 3600 ),
#
- # DST is always 0 because Time::Object
- # currently (v 1.00) adds one to the
- # tzoffset during DST hours
+ # DST is always 0 because DateTime
+ # currently (v 0.16) adds one to the
+ # offset during DST hours
0,
$alt );
return $sun_rise;
@@ -635,20 +631,16 @@
my $alt = shift || -0.833;
my $offset = int( shift || 0 );
- my $today = localtime;
- #
- # Not sure why appending a 'D' to the offset didn't work. So converted
- # the days into seconds...
- #
- $today = $today + $offset * 86400;
+ my $today = DateTime->today->set_time_zone( 'local' );
+ $today->add( days => $offset );
my( undef, $sun_set ) = sunrise( $today->year, $today->mon, $today->mday,
$longitude, $latitude,
- $today->tzoffset->hours,
+ ( $today->offset / 3600 ),
#
- # DST is always 0 because Time::Object
- # currently (v 1.00) adds one to the
- # tzoffset during DST hours
+ # DST is always 0 because DateTime
+ # currently (v 0.16) adds one to the
+ # offset during DST hours
0,
$alt );
return $sun_set;