Equation of Time (EoT)
The Equation of Time (EoT) is a parameter that describes the difference between the true solar time and the mean solar time. The mean solar time is the time that would be shown by a perfect clock moving uniformly, while the true solar time is based on the actual position of the Sun in the sky.
Formula used
Where:
= Obliquity Correction (degrees)
= Geometric Mean Longitude of the Sun
= Eccentricity of Earth's Orbit
= Geometric Mean Anomaly of the Sun
= Geometric Mean Longitude of the Sun
Code Implementation
../prayertimes2025//pt_engine/astro_helpers/equation_of_time.py
import math
from .sun_parameters import geom_mean_long_sun, geomc_mean_anom_sun
from .earth_parameters import mean_obliquity_of_ecliptic, obliquity_correction, eccentricity_of_earth_orbit
from .julian_date import julian_date
from .julian_century import julian_century
def _var_y(obliq_corr_deg: float) -> float:
"""Calculate the variable y, based on the Obliquity Correction."""
return math.tan(math.radians(obliq_corr_deg / 2)) ** 2
def equation_of_time(
year: int,
month: int,
day: int,
hours: float,
utc_offset: float
) -> float:
# Calculate the Julian Date
j_d = julian_date(year, month, day, hours, utc_offset)
# Calculate the Julian Century
j_c = julian_century(j_d)
# Calculate the necessary intermediate values
gmls = geom_mean_long_sun(j_c)
gmas = geomc_mean_anom_sun(j_c)
eeo = eccentricity_of_earth_orbit(j_c)
epsilon_0 = mean_obliquity_of_ecliptic(j_c)
obliq_corr = obliquity_correction(epsilon_0, j_c)
y_value = _var_y(obliq_corr)
# Calculate the Equation of Time (EoT)
term1 = y_value * math.sin(2 * math.radians(gmls))
term2 = -2 * eeo * math.sin(math.radians(gmas))
term3 = 4 * eeo * y_value * math.sin(math.radians(gmas)) * math.cos(2 * math.radians(gmls))
term4 = -0.5 * y_value * y_value * math.sin(4 * math.radians(gmls))
term5 = -1.25 * eeo * eeo * math.sin(2 * math.radians(gmas))
eot = 4 * math.degrees(term1 + term2 + term3 + term4 + term5)
return eot
↗ View in github