Thread: So it begins.
View Single Post
Old 06-21-2006, 04:48 PM   #55
shotgunefx
FLAC
 
shotgunefx's Avatar
 
Join Date: Apr 2005
Location: Boston, MA
Vehicle: 2002 Chrysler Sebring Coupe LXI
Posts: 1,761
My Photos: ()
Sample
Code:
#!/usr/bin/perl use strict; use warnings; use Astro::Sunrise; my ($long,$lat) = qw (-842259 334359); # Specify yours or get from GPS my $now = join(":", (localtime) [2,1]); my $sun_rise = sun_rise($long, $lat); my $sun_set = sun_set($long, $lat ); print "Now $now, sunrise \@ $sun_rise, sunset at \@ $sun_set\n"; if ($now gt $sun_rise and $now lt $sun_set){ print "It's daytime, do something!\n"; }else { print "It's nighttime!, do something\n"; }

shotgunefx is offline   Reply With Quote