Actually, the amount of refraction changes with air temperature, pressure, and the elevation of the observer (see Chapter 16). A change of temperature from winter to summer can shift the times of sunrise and sunset by about 20 seconds in mid-northern and mid-southern latitudes. Similarly, observing sunrise or sunset over a range of barometric pressures leads to a variation of a dozen seconds in the times.
It turns out that something as “simple” as calculating Sunrise is anything but. After you’ve worked out all the geometric positions of the planets, you then have to run your simulation backwards due to the ~8 minute light delay, and then you’ve got to take the pesky atmosphere into account, as it changes the apparent position of everything over the course of the sky. The effect is non uniform, which is why the Sun on the horizon looks squashed.
Working out all this math (with the help of my trusty copy of Astronomical Algorithms), and putting it into code for Where is Io, remains a taxing mental exercise, but one I am immensely enjoying.