1
1
/*
2
2
* Zmanim Java API
3
- * Copyright (C) 2004-2022 Eliyahu Hershfeld
3
+ * Copyright (C) 2004-2023 Eliyahu Hershfeld
4
4
*
5
5
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
6
6
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
10
10
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11
11
* details.
12
12
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
13
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA,
13
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA,
14
14
* or connect to: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
15
15
*/
16
16
package com .kosherjava .zmanim ;
64
64
* </pre>
65
65
*
66
66
*
67
- * @author © Eliyahu Hershfeld 2004 - 2022
67
+ * @author © Eliyahu Hershfeld 2004 - 2023
68
68
*/
69
69
public class AstronomicalCalendar implements Cloneable {
70
70
@@ -489,11 +489,17 @@ public long getTemporalHour(Date startOfday, Date endOfDay) {
489
489
}
490
490
491
491
/**
492
- * A method that returns sundial or solar noon. It occurs when the Sun is <a href
493
- * ="https://en.wikipedia.org/wiki/Transit_%28astronomy%29">transiting</a> the <a
494
- * href="https://en.wikipedia.org/wiki/Meridian_%28astronomy%29">celestial meridian</a>. In this class it is
495
- * calculated as halfway between sea level sunrise and sea level sunset, which can be slightly off the real transit
496
- * time due to changes in declination (the lengthening or shortening day).
492
+ * A method that returns sundial or solar noon. It occurs when the Sun is <a href=
493
+ * "https://en.wikipedia.org/wiki/Transit_%28astronomy%29">transiting</a> the <a
494
+ * href="https://en.wikipedia.org/wiki/Meridian_%28astronomy%29">celestial meridian</a>. The calculations used by
495
+ * this class depend on the {@link AstronomicalCalculator} used. If this calendar instance is {@link
496
+ * #setAstronomicalCalculator(AstronomicalCalculator) set} to use the {@link com.kosherjava.zmanim.util.NOAACalculator}
497
+ * (the default) it will calculate astronomical noon. If the calendar instance is to use the
498
+ * {@link com.kosherjava.zmanim.util.SunTimesCalculator}, that does not have code to calculate astronomical noon, the
499
+ * sun transit is calculated as halfway between sea level sunrise and sea level sunset, which can be slightly off the
500
+ * real transit time due to changes in declination (the lengthening or shortening day). See <a href=
501
+ * "https://kosherjava.com/2020/07/02/definition-of-chatzos/">The Definition of Chatzos</a> for details on the proper
502
+ * definition of solar noon / midday.
497
503
*
498
504
* @return the <code>Date</code> representing Sun's transit. If the calculation can't be computed such as in the
499
505
* Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
@@ -502,7 +508,8 @@ public long getTemporalHour(Date startOfday, Date endOfDay) {
502
508
* @see #getTemporalHour()
503
509
*/
504
510
public Date getSunTransit () {
505
- return getSunTransit (getSeaLevelSunrise (), getSeaLevelSunset ());
511
+ double noon = getAstronomicalCalculator ().getUTCNoon (getAdjustedCalendar (), getGeoLocation ());
512
+ return getDateFromTime (noon , false );
506
513
}
507
514
508
515
/**
@@ -730,10 +737,10 @@ public AstronomicalCalculator getAstronomicalCalculator() {
730
737
/**
731
738
* A method to set the {@link AstronomicalCalculator} used for astronomical calculations. The Zmanim package ships
732
739
* with a number of different implementations of the <code>abstract</code> {@link AstronomicalCalculator} based on
733
- * different algorithms, including {@link com.kosherjava.zmanim.util.SunTimesCalculator one implementation } based
734
- * on the <a href = "http ://aa.usno.navy.mil/">US Naval Observatory 's</a> algorithm, and
735
- * {@link com.kosherjava.zmanim.util.NOAACalculator another } based on <a href= "https://noaa.gov">NOAA's</a>
736
- * algorithm. This allows easy runtime switching and comparison of different algorithms.
740
+ * different algorithms, including the default {@link com.kosherjava.zmanim.util.NOAACalculator } based on <a href=
741
+ * "https ://noaa.gov">NOAA 's</a> implementation of Jean Meeus's algorithms as well as {@link
742
+ * com.kosherjava.zmanim.util.SunTimesCalculator } based on the <a href = "https://www.cnmoc.usff.navy.mil/usno/">US
743
+ * Naval Observatory's</a> algorithm, . This allows easy runtime switching and comparison of different algorithms.
737
744
*
738
745
* @param astronomicalCalculator
739
746
* The astronomicalCalculator to set.
0 commit comments