|
1 | 1 | /*
|
2 | 2 | * Zmanim Java API
|
3 |
| - * Copyright (C) 2004-2018 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)
|
|
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 | 13 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA,
|
14 |
| - * or connect to: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html |
| 14 | + * or connect to: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html |
15 | 15 | */
|
16 | 16 | package com.kosherjava.zmanim.util;
|
17 | 17 |
|
18 | 18 | import java.util.Calendar;
|
19 | 19 |
|
20 | 20 | /**
|
21 | 21 | * Implementation of sunrise and sunset methods to calculate astronomical times. This calculator uses the Java algorithm
|
22 |
| - * written by <a href="http://web.archive.org/web/20090531215353/http://www.kevinboone.com/suntimes.html">Kevin |
23 |
| - * Boone</a> that is based on the <a href = "http://aa.usno.navy.mil/">US Naval Observatory's</a><a |
24 |
| - * href="http://aa.usno.navy.mil/publications/docs/asa.php">Almanac</a> for Computer algorithm ( <a |
25 |
| - * href="http://www.amazon.com/exec/obidos/tg/detail/-/0160515106/">Amazon</a>, <a |
26 |
| - * href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?isbn=0160515106">Barnes & Noble</a>) and is |
27 |
| - * used with his permission. Added to Kevin's code is adjustment of the zenith to account for elevation. |
| 22 | + * written by <a href="htts://web.archive.org/web/20090531215353/http://www.kevinboone.com/suntimes.html">Kevin |
| 23 | + * Boone</a> that is based on the <a href = "https://aa.usno.navy.mil/">US Naval Observatory's</a><a |
| 24 | + * href="https://aa.usno.navy.mil/publications/asa">Astronomical Almanac</a> and used with his permission. Added to Kevin's |
| 25 | + * code is adjustment of the zenith to account for elevation. This algorithm returns the same time every year and does not |
| 26 | + * account for leap years. It is not as accurate as the Jean Meeus based {@link NOAACalculator} that is the default calculator |
| 27 | + * use by the KosherJava <em>zmanim</em> library. |
28 | 28 | *
|
29 |
| - * @author © Eliyahu Hershfeld 2004 - 2020 |
| 29 | + * @author © Eliyahu Hershfeld 2004 - 2023 |
30 | 30 | * @author © Kevin Boone 2000
|
31 | 31 | */
|
32 | 32 | public class SunTimesCalculator extends AstronomicalCalculator {
|
@@ -252,4 +252,26 @@ private static double getTimeUTC(Calendar calendar, GeoLocation geoLocation, dou
|
252 | 252 | }
|
253 | 253 | return pocessedTime;
|
254 | 254 | }
|
| 255 | + |
| 256 | + /** |
| 257 | + * Return the <a href="https://en.wikipedia.org/wiki/Universal_Coordinated_Time">Universal Coordinated Time</a> (UTC) |
| 258 | + * of <a href="https://en.wikipedia.org/wiki/Noon#Solar_noon">solar noon</a> for the given day at the given location |
| 259 | + * on earth. This implementation returns solar noon as the time halfway between sunrise and sunset. |
| 260 | + * Other calculators may return true solar noon. See <a href= |
| 261 | + * "https://kosherjava.com/2020/07/02/definition-of-chatzos/">The Definition of Chatzos</a> for details on solar |
| 262 | + * noon calculations. |
| 263 | + * @see com.kosherjava.zmanim.util.AstronomicalCalculator#getUTCNoon(Calendar, GeoLocation) |
| 264 | + * @see NOAACalculator |
| 265 | + * |
| 266 | + * @param calendar |
| 267 | + * The Calendar representing the date to calculate solar noon for |
| 268 | + * @param geoLocation |
| 269 | + * The location information used for astronomical calculating sun times. |
| 270 | + * @return the time in minutes from zero UTC |
| 271 | + */ |
| 272 | + public double getUTCNoon(Calendar calendar, GeoLocation geoLocation) { |
| 273 | + double sunrise = getUTCSunrise(calendar, geoLocation, 90, true); |
| 274 | + double sunset = getUTCSunset(calendar, geoLocation, 90, true); |
| 275 | + return (sunrise + ((sunset - sunrise) / 2)); |
| 276 | + } |
255 | 277 | }
|
0 commit comments