sscalc
— calculate
time of sunrise and sunset
sscalc |
[-rs ] [-n
reps] [-m
month] [-d
day] [-f
format] [-o
longitude] [-a
latitude] |
sscalc
calculates the time of sunrise and
sunset for a date and location and prints the results.
In order to calculate the sunrise and sunset, the
sscalc
program must know the latitude and longitude
of your location. You can pass this information to the program via
environment variables or via the command line.
To set the longitude via the command line, use the
-o
option. Similarly, to set the latitude, use the
-a
option. The number passed must be a floating
point representation of the degrees of longitude or latitude. Locations west
of the prime meridian are represented as positive numbers, those located
east of GMT are negative numbers. North latitudes are positive, while south
latitudes are negative. For example, the longitude of Walnut Creek,
California, is 122.06 and its latitude is 37.90.
The program will also search the environment for the variables
LATITUDE
and LONGITUDE
. The
format of these variables is exactly the same as on the command line.
By default, sscalc
will print the sunrise
and/or sunset for the current date. You may change the date being calculated
by using the -m
and -d
options to set the month and day. The month must be a number from 1 to 12,
while the day must be from 1 to 31. Times are printed out in the default
representation for the locale.
To restrict the output, use the -r
or
-s
flag to print only the sunrise or sunset
respectively. To print a series of times, use the -n
option to pass the number of dates to print out.
To print the sunrise and sunset for Acapulco, Mexico on the first
day of summer, you'd use
sscalc -m 6 -d 21 -o 99.77 -a
16.75
The calculations are an approximation and may be wrong by as much
as two minutes.
When calculating times for areas above the Arctic or below the
Antarctic Circles, the program will report the times for the nearest
(chronologically) sunrise and sunset. The year reported will be incorrect
sometimes, but the day of year will be correct.
Sunrise and sunset times are calculated internally to GMT, and
displayed in the local timezone. If the coordinates given don't match the
current timezone setting, expect results that are off by a number of
hours.
Included with the sscalc
program is the
cities.txt file, which has the latitude and
longitude for a whole lot of cities around the world. This file will
normally be installed in
/usr/local/share/doc/sscalc/cities.txt.
Keith Walker
⟨kew@icehouse.net⟩ did the port of a web page that at the time
of this writing was
http://www.srrb.noaa.gov/highlights/sunrise/gen.html.
This ported code was released with the permission of the author of the
original code, Chris Cornwall.