Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/com/kosherjava/zmanim/AstronomicalCalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,9 @@ public double getSunsetSolarDipFromOffset(double minutes) {
* @see GeoLocation#getLocalMeanTimeOffset(Instant)
*/
public Instant getLocalMeanTime(LocalTime localTime) {
Instant civilTime = ZonedDateTime.of(getAdjustedLocalDate(), localTime, getGeoLocation().getZoneId()).toInstant();
return getTimeOffset(civilTime, -getGeoLocation().getLocalMeanTimeOffset(civilTime));
Instant localMeanTime = LocalDateTime.of(getAdjustedLocalDate(), localTime).toInstant(ZoneOffset.UTC);
long longitudeOffsetMillis = (long) (getGeoLocation().getLongitude() * 4 * MINUTE_MILLIS);
return getTimeOffset(localMeanTime, -longitudeOffsetMillis);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,9 @@ public void minusMonths(int months){
if (month == TISHREI) {
month = ELUL;
year--;
} else if ((! isJewishLeapYear(year) && month == ADAR)
|| (isJewishLeapYear(year) && month == ADAR_II)){
} else if (month == NISSAN) {
month = getLastMonthOfJewishYear(year);
} else if (!isJewishLeapYear(year) && month == ADAR){
month = SHEVAT;
} else {
month--;
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/com/kosherjava/zmanim/util/NOAACalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,15 @@ private static double getSolarNoonMidnightUTC(double julianDay, double longitude
double tnoon = getJulianCenturiesFromJulianDay(julianDay + longitude / 360.0);
double equationOfTime = getEquationOfTime(tnoon);
double solNoonUTC = (longitude * 4) - equationOfTime; // minutes

// second pass
double newt = getJulianCenturiesFromJulianDay(julianDay + solNoonUTC / 1440.0);
equationOfTime = getEquationOfTime(newt);
return (solarEvent == SolarEvent.NOON ? 720 : 1440) + (longitude * 4) - equationOfTime;

// Refine the equation of time at the calculated transit time.
double newt;
for (int i = 0; i < 2; i++) {
newt = getJulianCenturiesFromJulianDay(julianDay + solNoonUTC / 1440.0);
equationOfTime = getEquationOfTime(newt);
solNoonUTC = (solarEvent == SolarEvent.NOON ? 720 : 1440) + (longitude * 4) - equationOfTime;
}
return (solarEvent == SolarEvent.NOON ? 720 : 1440) + (longitude * 4 ) - equationOfTime;
}

/**
Expand Down
Loading