|
SunTimes documentation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.web_tomorrow.utils.suntimes.SunTimes
Java class for calculating sunset and sunrise times.
This class exposes two methods only: getSunsetTimeUTC and getSunriseTimeUTC. Both take all the parameters necessary to make the calculation; that is, nothing is assumed, and no system information is used. If the caller wants to make, for example, the current year or geographical location the default, then it has to do that itself. The caller also needs to supply the Sun's zenith, which is subject to some interpretation. For most purposes, the constant ZENITH defined in this class will do the trick for true sunrise and sunset. There are other zenith constants for various types of twilight.
The methods in this class return a UTC time, not a local time.
This allows its operation to be independent of the system. If the
caller requires a local time, which is likely, it needs to convert it.
Methods are provided in the Java TimeZone
class to do
this, but they rely on the system time zone and clock to be correct.
See the overview for details of how to use this class
PS: for testing purposes, London UK is latitude 51, longitude 0
(c)2001 Kevin Boone/Web-Tomorrow, all rights reserved
Field Summary | |
static double |
ASTRONOMICAL_ZENITH
Sun's zenith at astronomical twilight |
static double |
CIVIL_ZENITH
Sun's zenith at civil twilight |
static double |
NAUTICAL_ZENITH
Sun's zenith at nautical twilight |
static double |
ZENITH
Default value for Sun's zenith and true rise/set |
Constructor Summary | |
SunTimes()
|
Method Summary | |
static Time |
getSunriseTimeUTC(int year,
int month,
int day,
double longitude,
double latitude,
double zenith)
GetSunriseTimeUTC gets the time of sunrise at the specified latitude and longitude on the specified day. |
static Time |
getSunsetTimeUTC(int year,
int month,
int day,
double longitude,
double latitude,
double zenith)
getSunsetTimeUTC gets the time of sunrise at the specified latitude and longitude on the specified day. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final double ZENITH
public static final double CIVIL_ZENITH
public static final double NAUTICAL_ZENITH
public static final double ASTRONOMICAL_ZENITH
Constructor Detail |
public SunTimes()
Method Detail |
public static Time getSunriseTimeUTC(int year, int month, int day, double longitude, double latitude, double zenith) throws SunTimesException
year 4-digit year month month, 1-12 day day of month, 1-31 longitute in degrees, longitudes west of Meridian are negative latitute in degrees, latitudes south of equator are negative zenith Sun's zenith, in degrees
public static Time getSunsetTimeUTC(int year, int month, int day, double longitude, double latitude, double zenith) throws SunTimesException
year 4-digit year month month, 1-12 day day of month, 1-31 longitute in degrees, longitudes west of Meridian are negative latitute in degrees, latitudes south of equator are negative zenith Sun's zenith, in degrees
|
(c)2001 Kevin Boone/Web-Tomorrow | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |