getUTCSunset method

double getUTCSunset (
  1. DateTime dateTime,
  2. GeoLocation geoLocation,
  3. double zenith,
  4. bool adjustForElevation
)
override

@see net.sourceforge.zmanim.util.AstronomicalCalculator#getUTCSunset(Calendar, GeoLocation, double, boolean)

Implementation

double getUTCSunset(
    DateTime dateTime, GeoLocation geoLocation, double zenith, bool adjustForElevation) {
  double elevation = adjustForElevation ? geoLocation.getElevation() : 0;
  double adjustedZenith = adjustZenith(zenith, elevation);

  double sunset = _getSunsetUTC(_getJulianDay(dateTime), geoLocation.getLatitude(),
      -geoLocation.getLongitude(), adjustedZenith);
  sunset = sunset / 60;

  // ensure that the time is >= 0 and < 24
  while (sunset < 0.0) {
    sunset += 24.0;
  }
  while (sunset >= 24.0) {
    sunset -= 24.0;
  }
  return sunset;
}