/// <summary> /// Calculate prayer time for zuhr. /// </summary> private static double ComputeZuhrTime(double jd) { var dayFraction = AstronomyMath.GetDayFraction(ZuhrDefaultTime); var midDay = AstronomyMath.ComputeMidDay(jd, dayFraction); // The fiqh method which states that zuhr is when the sun's disk comes out // of its zenith line, which is a line between the observer and the center // of the sun when it is at the highest point is used here. Thus, // additional 65 seconds is added to the mid day time, which corresponds // to the formula t = arctan(r/d) / 2π × 24 × 60 × 60, where r is the // radius of the sun (r = 695,000km), d is the sun-earth distance // (d = 147,098,074km at minimum and d = 152,097,701km at maximum). // When, d is at maximum, t evaluates to ~62 seconds and ~65 seconds when // d is at minimum. Converting 65 seconds to hour yields a value of // 0.018055555555555554. var zuhrTime = midDay + 0.018055555555555554; return(zuhrTime); }
// ReSharper disable once InconsistentNaming public void TestComputeMidDayOnApril12th2018() { var mid = AstronomyMath.ComputeMidDay(Jd, 0.5); Assert.Equal(12.014588571149947, mid); }