FAQ: Zmanim and Leap Seconds

Leap Second

Questions:

Answers:

  • Yes
  • Yes, but infinitesimally

Before delving into the answer, I would like to note that zmanim accuracy / precision down to the second that are supported by the API are really nonsense, because variations in refraction make this accuracy pointless. The second (or millisecond) zmanim accuracy / precision subject will hopefully have its own article in the future.
Since 1972, 27 leap seconds have been added to UTC time VS International Atomic Time (TAI). This is in addition to the initial 10 seconds added in 1972 to reflect pre-1972 corrections. The reason for adding leap seconds is to correct our clocks for incorrect original estimates of the speed of earth’s rotation. Assuming that you keep your clock time correct (and add the leap seconds), no change in any zmanim calculations by either the KosherJava zmanim library, or any other zmanim programs or APIs are needed. However, if you have a very accurate clock, and did not change it since 1972, your zmanim calculations will be off by 37 seconds. This is not something any zmanim APIs, apps or programs should have to deal with. Had we added any corrections for leap seconds, your zmanim calculations would be inaccurate.
As far as the Tōhoku earthquake in Japan, this is really the same question as the first question. Yes, that earthquake slowed down earth’s rotation by 1.8 microseconds or 1.8 millionth of a second (meaningless for zmanim). This as well as the impact of other earthquakes that impact earth’s rotation are factored into the leap second calculations that “correct” the time of our clocks and ensure that your zmanim are correct.

Technical Details

The leap second corrections address incorrect clock time that result from a slower earth rotation than expected. To get a drop more technical (thank you Pinny Markowitz), when the rate or the angle of rotation changes (due to earthquakes or other natural or man-made changes such as building of the Three Gorges Dam), the changes are minuscule. These small changes as well as the original incorrect calculation of the length of the day add up over time. On occasion (about every 2 years) the accumulated difference is significant enough to warrant introducing (or theoretically removing, something that has yet to happen) a leap second to reconcile our clocks with the natural one. On any given day, UTC time always considers 86,400 (60 * 60 * 24) seconds as a day. On the day with a leap second, UTC time still considers the day as having only 86,400 seconds, but a second is added to account for each of the seconds over a year or more being a drop too short. There are various ways of making system clocks conform with the UTC standard, but the net effect is always the same, an extra second is added. UTC doesn’t view a second the same way that the atomic clocks (International Atomic Time) do. UTC views a second as 1/86,400 of a relative day (that is actually 86,400.002 seconds long on average), while, atomic clocks count a day as 86,400 fixed length seconds. Fortunately, the approach of adding leap seconds is exactly what we need when calculating zmanim. By ignoring leap second events in zmanim code, and instead focusing on the measurements of a relative day, we can yield calculations that will be correct in the context of a relative day (assuming that you properly adjust your clock).

ZIP Codes and Zmanim – Use With Care

99557 ZIP code area (the largest in the USA)
99557 ZIP code area (the largest in the USA)

There are many zmanim services and apps that use ZIP codes as a location finder for calculating zmanim. While very convenient, there is a potential pitfall in using ZIP codes for geolocation. In general, ZIP code geolocation services will provide the center of the ZIP code and zmanim apps calculate zmanim for that location. The issue arises with large ZIP code areas mostly found in rural areas. Take the following two extreme cases that have very large ZIP code areas. ZIP code 89049 for rural Tonopah, NV, is 195 km (121 mi) from east to west. The eastern boundary of this non-contiguous ZIP code has a longitude of -115.417°, while the western boundary is -117.625°. This means that there are 2.2° of longitude between the eastern and western borders of this ZIP code. The earth rotates 1° every 4 minutes, so zmanim at the eastern and western edges of this ZIP code are approximately 8.8 minutes apart. Using the typical center-of-the-ZIP-based calculations would mean that zmanim would be about 4.4 minutes different at the edges compared to the center. Moving to something a bit more extreme is the case of ZIP code 99557 of Aniak, Alaska and its surrounding area. This ZIP code is 415 km (258 mi) from east to west. The longitude of the eastern edge of the ZIP code is -153.032°, and the western edge is -160.783°. Being farther north and therefore having shorter distances between degrees of longitude, this ZIP code stretches across 7.7° of longitude. The zmanim difference from the center to the edges of this ZIP code is 15 and a half minutes (31 minutes across the ZIP code). While it is indeed rare to have such large distances, there are 193 US ZIP codes that are over 1° of longitude wide, meaning that the zmanim for these ZIP codes are at least 4 minutes apart, or 2 minutes off from the center. There are 1,463 or 4.4% of all ZIP codes with 0.5° or greater distance between east and west (a minimum of a 2-minute zmanim difference between the east and west side of the ZIP code). Zmanim software developers should be aware of this, and take care to alert users of possible inaccuracies when using large ZIP code areas, or require addresses or more specific location information for large ZIP codes.
Let’s contrast the above with Lakewood, NJ. With 0.107° of longitude from east to west, zmanim are about 26 seconds later on the west side (the intersection of New Central Ave & N Hope Chapel Rd) than the east side (Shinn Cranes, 1600 Ocean Ave). New York City is larger, and from the western edge of Staten Island to Glen Oaks, the eastern edge of Queens, there is a difference of 2 minutes and 11 seconds in zmanim.
See the Calculation of Zmanim VS Other Sites post for additional related material.
I thank Avraham David Gelbfish for generating the ZIP code longitude range for all 33,093 ZIP codes from the US Census Bureau ZIP code shape files.

Zmanim For Kiddush Levana Before Shavuos 5778

Crescent MoonRarely do you find zmanim that are days apart based on your location, but this year, that is exactly what will happen. With Shavuos falling on a Sunday and Monday, we end up with a “three-day Yom Tov” that impacts the earliest time / zman that קידוש לבנה Kiddush Levana can be said (for those who say it 3 days after the מולד molad). With the minhag that Kiddush Levana is not said on Shabbos or Yom Tov, there is only a small chance to say Kiddush Levana on Thursday night, depending on your location. The molad for the month of Sivan was at 6:00:23 am in Yerushalayim (5:21 am and 6 chalakim local mean time using the traditional calculation) on Rosh Chodesh Sivan, Tuesday, May 15. This results in techilas zman Kiddush Levana 3 days later at 6:00:23 am Friday morning, May 18. This is well after the moon sets, and actually after the sun rises. It can’t be said on Friday night or Motzai Shabbos, since they are Shabbos and Yom Tov. The earliest it can be said in Israel is on Sunday night. Much farther west in NY or Lakewood, NJ, where 2 days of Yom Tov are observed, you get close to being able to say it on Thursday night, but not close enough. Kiddush Levana could theoretically be said at 11:00 pm Thursday night, but by that time, the moon will already have set (at 10:38 pm in Lakewood, and at 10:39 pm in Brooklyn, NY) and you end up having to wait until Monday night to say Kiddush Levana. From 11:00 pm on Monday night, even those who do not recite Kiddush Levana until 7 days after the molad can say it (moonset is at 1:20 am). Traveling farther west to Cleveland, OH with a moonset of 11:14 pm would seem to allow Kiddush Levana to be said on Thursday night. However, with the moon this close to the horizon, it would be almost impossible to see the moon and say Kiddush Levana on Thursday night before the moon sets. Going a little farther west, we hit the first locations that can say Kiddush Levana on Thursday night. Chicago (and other areas along its longitude) with a techilas zman Kiddush Levana of 10:00 pm and a moonset of 10:40 pm would likely be the first places in the world to say Kiddush Levana this year.
Thus, from Chicago to the west coast of the USA and Canada, Kiddush Levana can be said 3 days before Israel, and 4 days before Europe and eastern USA and Canada.

Parsha Code Removed from KosherJava Zmanim Calendar API

Sunrise CalendarDue to licensing issues that were brought to my attention last year, the parsha code was removed from the Zmanim API on August 22, 2016. In the future I may release the parsha code as a standalone module under the GPL, or create a new LGPL implementation. To understand this more clearly, the current Zmanim API is licensed under the LGPL, while the parsha code contained some GPL code that had to be removed in order to keep the API under the LGPL. I would welcome any code submission for parsha code that could be released under the LGPL.

Update: Parsha Code Restored

On November 17, 2019 – י״ט מרחשון תש״פ, an updated post Parsha Code Restored to the KosherJava Zmanim Calendar API announced the restoration of the parsha functionality.

FAQ: Different Parshas Hashavua in Eretz Yisrael Than Chutz La’aretz

KosherJava Zmanim API FAQ

Question:

Why does the KosherJava Zmanim API seem to sometimes return the incorrect parshas hashavua in Israel?

Answer:

I have had a number of inquiries this year about the incorrect parshas hashavua being returned by the API. In all cases this has been a complaint for Eretz Yisrael and not chutz la’aretz. The explanation is pretty simple and covered in the API documentation for the JewishCalendar class, but may not be clear to all. When the first day of Pesach occurs on a Shabbos, as it did this year (5775), the last day of Pesach in Eretz Yisrael is on a Friday. The following day is a regular Shabbos in Eretz Yisrael with the usual krias hatorah, but in chutz la’aretz it is the eighth day of Pesach, with the krias hatorah for Pesach. The following weeks will have different krias hatorah in Eretz Yisrael vs. chutz la’aretz, and this will continue for a number of weeks until a double parsha in chutz la’aretz brings the two back in sync. This last occurred in 2012 (before the release of the calendar functionality in the Zmanim 1.3 release) and will occur again next year. If you are coding to display the parshas hashavua for use in Israel, it is important to call setInIsrael(true) on the calendar (it has a default of false).

Note: The code samples below have been updated for the KosherJava Zmanim 3.x API.
jewishCalendar.setInIsrael(true);

A fuller example showing how to set the indicator and showing the comparison of Eretz Yisrael and chutz la’aretz this year can be seen in this example.

JewishCalendar israelCalendar = new JewishCalendar(5775, JewishDate.NISSAN, 7);
israelCalendar.setInIsrael(true); //set the calendar to Israel
JewishCalendar chutzLaaretzCalendar = new JewishCalendar(5775, JewishDate.NISSAN, 7);
chutzLaaretzCalendar.setInIsrael(false); //not really needed since the API defaults to false
HebrewDateFormatter hdf = new HebrewDateFormatter();
System.out.println(String.format("%-18s %s", "Date", "Chutz Laaretz / Eretz Yisrael"));
for (int i = 0; i < 57; i++) {
	israelCalendar.plusDays(1); //roll the date forward a day
	chutzLaaretzCalendar.plusDays(1); //roll the date forward a day
	if (chutzLaaretzCalendar.getDayOfWeek() == 7) { //only output Shabbos
		System.out.println(String.format("%-18s %s / %s", hdf.format(chutzLaaretzCalendar),
				hdf.formatParshah(chutzLaaretzCalendar), hdf.formatParshah(israelCalendar)));
	}
}

The output of this is:

Date               Chutz Laaretz / Eretz Yisrael
8 Nissan, 5775     Tzav / Tzav
15 Nissan, 5775     / 
22 Nissan, 5775     / Shmini
29 Nissan, 5775    Shmini / Tazria Metzora
6 Iyar, 5775       Tazria Metzora / Achrei Mos Kedoshim
13 Iyar, 5775      Achrei Mos Kedoshim / Emor
20 Iyar, 5775      Emor / Behar
27 Iyar, 5775      Behar Bechukosai / Bechukosai
5 Sivan, 5775      Bamidbar / Bamidbar

It should be noted that this discrepancy is not rare. Besides years when the first day of Pesach is on Shabbos, it also happens when Pesach starts on a Thursday, since the second day of Shavuos then falls on Shabbos in chutz la’aretz. Between the two, the krias hatorah differs for part of the year in a little more than half of all years.