Calculation of Sunrise and Sunset TimesThe calculation of sunrise and sunset times is based on the position of the sun relative to the observer's position on the Earth. The Earth rotates around its axis which takes approximately 24 hours to complete one rotation. This rotation causes the sun to appear to rise and set every day.
The position of the sun in the sky changes throughout the day and this position is measured using angles. The angle between the sun and the horizon is called the solar altitude angle. Sunrise and sunset times are calculated using this angle which varies depending on the latitude, longitude and altitude of the observer's position.
The solar altitude angle is also affected by atmospheric refraction which is the bending of light as it passes through the Earth's atmosphere. This bending causes the sun to appear higher in the sky than it actually is. This means that the sunrise and sunset times are slightly earlier than they would be without atmospheric refraction.